<?php
if(eregi("Googlebot",$_SERVER['HTTP_USER_AGENT'])){
    
// it says it's the lovely google
    
$ip = $_SERVER['REMOTE_ADDR'];
    
$name = gethostbyaddr($ip);
    
// Now we have the name, look up the corresponding IP address.
    
$host = gethostbyname($name);
    if(
eregi("Googlebot",$name)){
        if (
$host == $ip){
            
// We can be certain this is Googlebot. Set a flag to
            // do something useful for it perhaps, like not
            // bothering to load all the JavaScript.
        
}else{
            
// this is someone pretending to be the Googlebot.
            // have fun.
            // perhaps log the fake spiders and block their IPs
            // later.
        
}
    }
}
?>