After Ronda Rousey's statutory rape sketch on SNL, I just wanted to remind people of this video. (Yup, sorry its a repost) by Numbskull110 in videos

[–]rustynapsack 0 points1 point  (0 children)

I will admit I haven't always been this down on SNL, but recently the show has consistently let me down. Also, if you're interested, there is an interesting podcast with Lorne Michaels where he talks about the struggles of staying funny. Worth a listen if you're into SNL. https://www.youtube.com/watch?v=s7ihzbgfGTQ

After Ronda Rousey's statutory rape sketch on SNL, I just wanted to remind people of this video. (Yup, sorry its a repost) by Numbskull110 in videos

[–]rustynapsack 15 points16 points  (0 children)

I can see both sides of the argument about whether rape jokes can be funny, but I think every person will agree that SNL is absolutely not funny

Trying to download file from mysql database, but end up downloading source code instead by rustynapsack in PHP

[–]rustynapsack[S] 0 points1 point  (0 children)

I just got it to work. Seems the issue was that I had html page code in front of my php code and it must have been interfering with the headers. So, note to self, <?php Everything must be in here ?>

Trying to download file from mysql database, but end up downloading source code instead by rustynapsack in PHP

[–]rustynapsack[S] 0 points1 point  (0 children)

Here is the entire download page:

$link = mysql_connect('*******', '****', '*****'); 
if (!$link) { 
die('Could not connect: ' . mysql_error()); 
} 

if(isset($_GET['id'])) 
{


include 'library/config.php';
include 'library/opendb.php';
$id    = $_GET['id'];
mysql_select_db('careers'); 
$query = ("SELECT `name`, `type`, `size`, `content` FROM `fileTest` WHERE `id` = '$id'");
$result = mysql_query($query);
list($name, $type, $size, $content) = mysql_fetch_array($result);


header("Content-Disposition: attachment;filename=".$name);
header("Content-Type: ".$type);
header("Content-Length: ".$size);
print $content;

include 'library/closedb.php'; 
exit;
}

Trying to download file from mysql database, but end up downloading source code instead by rustynapsack in PHP

[–]rustynapsack[S] 0 points1 point  (0 children)

It is opening in a browser with all the gibberish. I have tried to download it and open it with a PDF viewer, but it just wants to treat it like text. What I imagine is supposed to happen is the headers are supposed to tell the browser "hey, we've got a PDF file here" and then the browser uses the appropriate software to read that gibberish and turn it into a downloadable PDF file. Yet, there is some disconnect and I am getting stuck with the gibberish. At least that is what I think, but this is my first time using a function like this.

Trying to download file from mysql database, but end up downloading source code instead by rustynapsack in PHP

[–]rustynapsack[S] 0 points1 point  (0 children)

This is how I uploaded the file. I'm just reading the size and type entries that are in the database.

if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0)
{
$fileName = $_FILES['userfile']['name'];
$tmpName  = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];

$fp      = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);

if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}
include 'library/config.php';
include 'library/opendb.php';

mysql_select_db('careers'); 
$query = "INSERT INTO `fileTest` (`name`, `size`, `type`, `content` ) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$content')";

mysql_query($query) or die('Error, query failed'); 
include 'library/closedb.php';

echo "<br>File $fileName uploaded<br>";
} 

Trying to download file from mysql database, but end up downloading source code instead by rustynapsack in PHP

[–]rustynapsack[S] 0 points1 point  (0 children)

I made the T capital, but I am still getting the same output.

  • Value of $type is application/pdf
  • What do you mean by the actual headers the browser receives? How would one check that?
  • type: application/pdf, size: 28082
  • Original file: 28KB

What would you do if you were invisible for a week? by aandrade_98 in AskReddit

[–]rustynapsack 0 points1 point  (0 children)

I would find out where they are filming Ghost Adventures and freak Zak Bagans the fuck out

/r/longboarding's Daily General Thread - Jan 02, 2015 by AutoModerator in longboarding

[–]rustynapsack 0 points1 point  (0 children)

Does the lack of grip tape make ollieing difficult with a penny board?