Hey guys,
I have an online list that tells me how many users are online. It also display which of my registered users are online too.
What i'd like to do is get my script to recognised bots like google aswell and add them to my list.
My code is something like this:
PHP Code:
$timestamp = time();
$timeout = $timestamp - 900;
$d=mysql_query("UPDATE `Member` SET `timest` = '$timestamp' WHERE `ID` ='$userid2'") or die(mysql_error());
//Insert User
$insert = mysql_query("INSERT INTO online (timestamp, ip, file) VALUES('$timestamp','".$_SERVER['REMOTE_ADDR']."','".$_SERVER['PHP_SELF']."')") or die("Error in who's online insert query!");
$result = mysql_query("SELECT DISTINCT ip FROM online") or die("Error in who's online result query!");
$users = mysql_num_rows($result);
//Display all users who have been online within the last 5minutes.
$sel=mysql_query("SELECT * FROM `Member` WHERE `timest` > '$timeout' ORDER BY `ID`") or die(mysql_error());
$n=mysql_num_rows($sel);
$users = $users - $n;
echo"Members Online: $n | Guests: $users<br> ";
How would i try and recognise google bots? Does google use a specific I.P. that i have to register or something :X?
Thanks for your help.