I have a mysql counter/hits script below that count all new ip adresses, but not the ones already counted. I would like to change it so that it count also all existing ip addresses except my own. Would greatly apreciate help on this.
<?php
$username = "username";
$password = "password";
$host = "localhost";
$database = "databasename";
$table = "tablename";
mysql_connect($host,$username,$password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error());
$ip=$_SERVER['REMOTE_ADDR'];
$browser=$_SERVER['HTTP_USER_AGENT'];
$date_now = date('Y.m.d - H:i:s');
$date_first = date('Y.m.d - H:i:s');
$ip_exists_check = "SELECT * from $table WHERE ip='$ip'";
$query=mysql_query($ip_exists_check);
$check=mysql_fetch_assoc($query);
if($check) {
$sql_update = "UPDATE $table SET date_now='$date_now' WHERE id='{$check[id]}'";
$do_update = mysql_query($sql_update);
}
else {
$sql_insert = "INSERT INTO $table (browser,ip,date_now,date_first)
VALUES ('$browser','$ip','$date_now','$date_first')";
$do_insert = mysql_query($sql_insert);
}
?>