hi
i have a hit counter that counts unique ip addresses i have worked out how to block my ip address so that whilst designing i do not add to the counter but how would i block google robots etc from increasing the counter - code is as follows:
CODE
<?
// includes connection file
include("dbconnect.inc.php");
$ip = $_SERVER['REMOTE_ADDR'];
$date = date('d.m.Y');
$block = "195.93.21..*";
$MySql = "SELECT * FROM counter WHERE ip = '$ip' AND date = '$date';";
$get = mysql_query($MySql) or die(mysql_error());
if (ereg($block, $ip)) {
}else{
// Counts the rows found
if(mysql_num_rows($get)==0) {
// If no rows where found
$select = mysql_query("INSERT INTO counter (ip, date, hits) VALUES ('$ip', '$date', '1')");
// Inserts into the database, there ip and date of visit
} else {
// If they have been
$hit = mysql_fetch_array($get);
// selects the data from the database
$hits = $hit['hits'] + 1;
// Adds one onto current hit counter
$select = mysql_query("UPDATE counter SET hits = '$hits' WHERE ip = '$ip' AND date = '$date'");
// Updates Database with there new hit count
}}
?>
*edit: Please use code tags in the future. Thanks!

thanks
This post has been edited by Martyr2: 9 Jan, 2008 - 12:52 PM