...

View Full Version : how to count hits and unique IP?



amitchouhanji
08-24-2006, 08:34 AM
hi all,
I want to track and save total hits that are done on my site.
I also want to save te unique IPs from which my site is being seen.
how can I do this using PHP.

I think there will be need to make a MYSQL database to save the hits and IPs,
how can I proceed in this?

Please solve my problem.

regards,
Amit Chouhan,
amitchouhanji@gmail.com

Mwnciau
08-24-2006, 08:51 AM
simple program / database
Mysql:


CREATE TABLE ip (ip VARCHAR(255) NOT NULL);




$ip = $_SERVER['REMOTE_ADDR'];
// connect to db
$query = mysql_query("SELECT * FROM ip WHERE ip='$ip';");
$result = mysql_fetch_array($query);
if (isset($result[ip]) || $result[ip] != $ip){
mysql_query("INSERT INTO ip (ip) VALUES ('$ip');");
}

amitchouhanji
08-24-2006, 02:47 PM
Thanx Mwnciau,
I think its working.

thanx for ur time ,

regards,
Amit Chouhan,
amitchouhanji@gmail.com



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum