Here's a simple and easy visitor info logger. It logs basic info, such as IP address and user agent to a log file. You just need to make an empty file named log.html and place it in the same directory as this PHP file for it to work. The visitor vists the PHP page and the info gets logged in the HTML file. Just simply visit the HTML page to see your results.
[PHP]<?php

/*
Visitor Information Logger
Coded by Moonbat
http://www.all-nettools.com
http://www.cybernin.net
*/

// Assigning the IP Address, User Agent, and Referer to variables
$ipaddress = $_SERVER['REMOTE_ADDR'];
$useragent = $_SERVER['HTTP_USER_AGNET'];
$referer = $_SERVER['HTTP_REFERER'];

// Opening up log.html
// The letter a is to signify that we just want only to
// write data to the end of the file while we have it open
$ourfile = fopen("log.html", "a");

// We will now write the data into the file
fwrite($ourfile, $ipaddress);
fwrite($ourfile, "<br>");
fwrite($ourfile, $useragent);
fwrite($ourfile, "<br>");
fwrite($ourfile, $referer);
fwrite($ourfile, "<br><br>");

// Closing connection with the file
fclose($ourfile);

?>
[/PHP]