HTTP_REFFERER problems

kraftwerk
07-12-2002, 12:07 AM
i'm trying to write some code that will look at the site you just came from and store the URL into a .txt file. its not working. here is my code:


<?
$fp = fopen('refferer.txt','a');

$reffer = getenv(HTTP_REFFERER);
fwrite($fp, $reffer);
?>

Robby
07-12-2002, 12:49 AM
Although I've never used PHP, I think it should be HTTP_REFERER

And keep in mind that REFERER will be blank if the user enters the URL in the address bar.

Cogen
07-12-2002, 01:54 PM
Robby is correct, it's HTTP_REFERER.

You might know this already, but just as a side note, this is set by the user agent, but not all user agents will set this. Therefore it's not really trustworthy.

Also, if your using php version 4.1.0 or higher you can use the $_SERVER["HTTP_REFERER"] instead. getenv(HTTP_REFFERER) will not work with register globals off feature (I don't think).

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum