function getrobot() {
if(!defined('IS_ROBOT')) {
$kw_spiders = 'Bot|Crawl|Spider|slurp|sohu-search|lycos|robozilla';
$kw_browsers = 'MSIE|Netscape|Opera|Konqueror|Mozilla';
if(!strexists($_SERVER['HTTP_USER_AGENT'], 'http://') && preg_match("/($kw_browsers)/i", $_SERVER['HTTP_USER_AGENT'])) {
define('IS_ROBOT', FALSE);
} elseif(preg_match("/($kw_spiders)/i", $_SERVER['HTTP_USER_AGENT'])) {
define('IS_ROBOT', TRUE);
} else {
define('IS_ROBOT', FALSE);
}
}
return IS_ROBOT;
}
这个函数到底是干嘛的

解决方案 »

  1.   

    判断来访者是否是搜索引擎----------------------------------------欢迎加入以google wave为交流工具的PHP及web开发讨论组: [email protected] 加入办法:1。 从你的gmail可以直接发信到 [email protected] 2。 PM你的邮箱给我,我直接加入 3。 到http://groups.google.com/group/phpwave/subscribe?note=1申请   如果该网址不能访问请尝试 https://groups.google.com/group/phpwave/subscribe?note=1       或 http://groups.google.co.uk/group/phpwave/subscribe?note=1 ...(或换其它国家域名) 
      

  2.   

    discuz里的一个函数, 判断是否有机械人, 即非浏览器访问者都被默认为机械人, 返回FALSE