
<?
//using the date() function
$time = date("F jS Y, h:iA");
//$remote_addr is PHP variable to get ip address
$ip = $REMOTE_ADDR;
//$http_referer is PHP variable to get referer
$referer = $HTTP_REFERER;
//$http_user_agent is PHP variable for browser
$browser = $HTTP_USER_AGENT;
//what page they came from
$page = $_SERVER['REQUEST_URI'];
//use the fopen() function
$fp = fopen("log.html", "a");
//using the fputs() function
fputs($fp, "
Time: $time
IP: $ip
Referer: $referer
Browser: $browser
Page: $page
");
fclose($fp);
?>
And that is basically all the code we have to write to set up a simple user log. You can place this code anywhere on your main page, and it will do the rest. Remember to make a blank log.html page, upload it to your server in the same directory as the page where the code will be located, and CHMOD it 777. Well thats it folks. I hope it works out for you and if it doesn't you can post a question.
Copyright © 2000-2008 Spoono, LLC. All rights reserved.
Network: Reseller Web Hosting by Spoono Host | Spoonloads | Absolute Cross
Terms of Service | Privacy Policy.