Full-service Internet Marketing & Web Development
Recent Posts

Sponsors
![]() |
Logs user host IP referer and browser to HTML fileCode Wizard, 12-30-2006 |
Er, to collect IPs etc
<?php
/*
-------------------------
Er, modified one of Tyler Longren's scripts (thanks for the base script Tyler) :)
This one logs the time, host, IP, referer, and browser to a file
named "visitors.html" (you'll need to create the file and chmod it to
something like 777 or 766 etc.. I would suggest putting it in a non
obvious place, to avoid hackers accessing your logs). No MySQL database
creation/knowladge required.
If there's a problem with the script.. mail someone else, I'm clueless :)
ATTN: This script was NOT meant to be used to collect user information for
any other reason than security purposes. Please respect people's privacy.
(more useless gabber: the log file gets big fast, be sure to delete it periodically...
you can also log multiple places to the same file, by specifying the visitor.html location)
God rules, as usual =)
----------
*/
$visitor_time = date("F jS Y, h:iA");
if ($REMOTE_HOST == "") $visitor_info = "ACK No host";
else $visitor_info = $REMOTE_HOST;
if ($REMOTE_ADDR == "") $visitor_info2 = "ACK No address";
else $visitor_info2 = $REMOTE_ADDR;
if ($HTTP_REFERER == "") $visitor_info3 = "OH DEAR No referer";
else $visitor_info3 = $HTTP_REFERER;
if ($HTTP_USER_AGENT == "") $visitor_info4 = "WEIRDNESS No browser or other browser used";
else $visitor_info4 = $HTTP_USER_AGENT;
$fp = fopen("../adh/visitors.html", "a");
fputs($fp, "<br>·******* $visitor_time<br>$visitor_info<br>$visitor_info2<b r>$visitor_info3<br>$visitor_info4<br>
");
fclose($fp);
?>
|
|
Subscribe Now to receive new posts via Email as soon as they come out.
Comments
Post your comments

