This is a very rudimentary way to determine if a user is a spider/webcrawler, and deal with them in different ways later in your scripts.

Code:
function DetermineIfUserIsSpider()
{
    $_aSpiders = array
    (
        "googlebot","yammybot","openbot","yahoo",
        "slurp","msnbot","baiduspider",
    );
    foreach ($_aSpiders as $_sSpider)
    {
        if (stristr($_SERVER['HTTP_USER_AGENT'],$_sSpider))
        {
            define("USER_IS_SPIDER",true);
            return;
        }
    }
    define("USER_IS_SPIDER",false);
}
DetermineIfUserIsSpider();