Call us Toll-Free:
Email us


Log visitor IP or Hostname to html file

Code Wizard, 12-30-2006

Script Note:
This script will log the users Hostname to a html file. If it can't resolve their hostname, it will just log their IP. You'll need a file called visitors.html and you should chmod visitors.html to 777. When you want to view your visitors, just view visitors.html. You can just copy this code and past it into your html. Whenever somebody visits your page, it will get their IP or Hostname and log it to visitors.html.

To the code!!!

if ($REMOTE_HOST == "") $visitor_info = $REMOTE_ADDR;
else $visitor_info = $REMOTE_HOST;
$fp = fopen("visitors.html", "a");
fputs($fp, " $visitor_info<br>

That's it. Pretty darn simple.
Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

Post your comments

Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.

About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions