Page 1 of 1

If HTTP Referrer = Ziltch.. How?

Posted: Tue May 02, 2006 9:51 pm
by djwk
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Heres My Code:

Code: Select all

<?

$ref = $_SERVER['HTTP_REFERER'];

$file = "data/ref.dat";
$fp = fopen($file, "w");
fwrite($fp, $ref);
fclose($fp);

?>
I Tried:

Code: Select all

<?

$ref = $_SERVER['HTTP_REFERER'];

if ($ref = "") {
   
   $echo "Unknown";

} else {
   
   $file = "data/ref.dat";
   $fp = fopen($file, "w");
   fwrite($fp, $ref);
   fclose($fp);

}

?>
However this doesn't work, it just writes nothing to ref.dat all the time, wondered if anyone could help me fix this?


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Tue May 02, 2006 9:53 pm
by feyd
hint: = vs == issue.

Posted: Tue May 02, 2006 9:55 pm
by djwk
Sorry about using

Code: Select all

instead of

Code: Select all

and what do you mean "Hint: = vs == issue."

Posted: Tue May 02, 2006 10:31 pm
by Benjamin
What he means is that = is an assignment operator.

Hence your if statement will always be true. == is a comparison operator.

Change your if statement to

Code: Select all

if ($blah == $blah) {

}

Posted: Wed May 03, 2006 5:14 am
by djwk
omg lmao, what an idiot! :P

Thanks lol