忙碌是偷懒的一种,比如懒得去思考我们为什么这样碌碌无为!
该日志由 Kevin 发表于 2006, June 22, 9:08 PM
<?
function get_naps_bot()
{
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
if (strpos($useragent, 'googlebot') !== false){
return 'Googlebot';
}
if (strpos($useragent, 'msnbot') !== false){
return 'MSNbot';
}
if (strpos($useragent, 'slurp') !== false){
return 'Yahoobot';
}
if (strpos($useragent, 'baiduspider') !== false){
return 'Baiduspider';
}
if (strpos($useragent, 'sohu-search') !== false){
return 'Sohubot';
}
if (strpos($useragent, 'lycos') !== false){
return 'Lycos';
}
if (strpos($useragent, 'robozilla') !== false){
return 'Robozilla';
}
return false;
}
function nowtime(){
$date=date("Y-m-d.G:i:s");
return $date;
}
$searchbot = get_naps_bot();
if ($searchbot) {
$tlc_thispage = addslashes($_SERVER['HTTP_USER_AGENT']);
$url=$_SERVER['HTTP_REFERER'];
$file="robotlog";
$time=nowtime();
$data=fopen($file,"a");
fwrite($data,"Time:$time robot:$searchbot URL:$urln");
fclose($data);
}
?>
以上代码保存为:robotcheck.php
在你网站每个页面任意位置加如下代码欺骗蜘蛛让其访问:
<a href=robotcheck.php><img src="robotcheck.php" width=12 height=12></a>
« 上一篇: 备忘:DMOZ中文登陆入口 | 下一篇:CGI Timeout的原因之一 »