Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-25-2008, 06:00 PM   PM User | #1
ole90
Regular Coder

 
Join Date: Jan 2007
Posts: 217
Thanks: 9
Thanked 0 Times in 0 Posts
ole90 is an unknown quantity at this point
Identifying Google Bots and others

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.
ole90 is offline   Reply With Quote
Old 07-26-2008, 10:35 PM   PM User | #2
runnerjp
Regular Coder

 
Join Date: Nov 2006
Posts: 601
Thanks: 1
Thanked 2 Times in 2 Posts
runnerjp can only hope to improve
try an allready built program for this
I second AW stats. It basically tells you what robots visited you, when the last one visited (time/date), how much bandwidth they consumed for the month, etc. Very handy if you dont' want to dig through the log files yourself.

If you have access to the log files, there's a program called Windows Grep which is basically a text analyzer, but it will let you search huge log files for text strings like "googlebot" or whatever you want, and it will only return those lines with "googlebot" in it, so you can see every single page that was requested, when, by what IP, etc.

obviusly if you find how they work you could take this on for urself.
runnerjp is offline   Reply With Quote
Old 07-26-2008, 11:33 PM   PM User | #3
boeing747fp
Regular Coder

 
Join Date: Oct 2003
Posts: 599
Thanks: 1
Thanked 1 Time in 1 Post
boeing747fp is an unknown quantity at this point
use crawltrack (http://www.crawltrack.fr/) it's really good at tracking a huge list of robots
boeing747fp is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:23 AM.


Advertisement
Log in to turn off these ads.