Web Site Statistics
This web statistics tutorial was contributed by Maddy.
You would have noticed that in many sites, they have almost all your details. Your IP, your browser , your referer and so on.. How do they do that? This Tutorial will help you in that matter. Now, let’s go!
Put all the following codes in your header.txt file and watch the magic
1) To get the time of access of your visitor,
<?php
$time=date("H:i dS F");
echo "$time";
?>
example output: Time: 21:48 23rd April
2)To get their IP Address:
<?php $IP=$_SERVER['REMOTE_ADDR']; echo "$IP"; ?>
example output: IP Address: 127.0.0.1
3)To get the URL of the Forwarding Page, you have to first check if they are forwarded, if yes the script will go ahead, if not it will not display this detail. You could do the same for the IP Address also.
<?php
if($_SERVER['HTTP_REFERER'] != null){
echo "Referer : $_SERVER['HTTP_REFERER']";
}
?>
example output: Referer : http://localhost/my_page.html
4) And, finally to get their Browser details,
<?php echo "Browser : $_SERVER['HTTP_USER_AGENT']"; ?>
example output: Browser : Mozilla/5.0………..
These are only a few; keep digging and you’ll find out more!
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.


Leave a Reply