Jump to content

Visitor logging script! problem HTTP_REFERRER


AbydosGater

Recommended Posts

Hi, Im working on a script that logges all users to my site..

[code]
$date = date ("F d, Y GMT TIME??");
$ip = $_SERVER['REMOTE_ADDR'];
$referer = "User has come from " . $_SERVER['HTTP_REFERRER'];
$file = $_SERVER['PHP_SELF'];
$docRoot = $_SERVER['DOCUMENT_ROOT'];
$logFile = "logs/visitors.log";
$log = "[$date] [$ip] [$docRoot$file] [$referer] \n";
$fp = fopen($logFile, "a");
fputs($fp, $log);
fclose($fp);

[/code]

Ok, and most of that works, except for one bit, when i open the file after a visitor, the $referer is empty, why is it not comming up? is it ment to have 2 'R's at the end? i tryed with one but no difference!

Oh and see for the GMT time, whats the format for GMT time?

I Would appriciate any help atall!

Thanks Abydos
Link to comment
Share on other sites

It's $_SERVER["HTTP_REFERER"], with one R.  While it can be forged, most people don't bother.  It's perfectly fine for collecting statistics about visitors, but not useful for security.  My experience is that most users leave it on.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.