一个PHP+TXT记录搜索引擎蜘蛛活动的程序

该日志由 Kevin 发表于 2006, June 22, 9:08 PM

<?

function 
get_naps_bot()
{
$useragent strtolower($_SERVER['HTTP_USER_AGENT']);

if (
strpos($useragent, 'googlebot') !== false){
return &
apos;Googlebot';
}

if (
strpos($useragent, 'msnbot') !== false){
return &
apos;MSNbot';
}

if (
strpos($useragent, 'slurp') !== false){
return &
apos;Yahoobot';
}

if (
strpos($useragent, 'baiduspider') !== false){
return &
apos;Baiduspider';
}

if (
strpos($useragent, 'sohu-search') !== false){
return &
apos;Sohubot';
}

if (
strpos($useragent, 'lycos') !== false){
return &
apos;Lycos';
}

if (
strpos($useragent, 'robozilla') !== false){
return &
apos;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);
}

?&
gt;

以上代码保存为:robotcheck.php

在你网站每个页面任意位置加如下代码欺骗蜘蛛让其访问:
<a href=robotcheck.php><img src="robotcheck.php&quotwidth=12 height=12></a>

网摘: Yahoo Baidu Google Bolaa 365Key Yesky Wozhai POCO ViVi YouNote Hexun Del.icio.us Yeeyoo igooi I2Key Cn3 Bytemen Furl Blinklist Blogmarks Technorati 分享到饭否

« 上一篇: 备忘:DMOZ中文登陆入口 | 下一篇:CGI Timeout的原因之一 »

引用: 点击获得Trackback地址,Encode: UTF-8 点击获得Trackback地址,Encode: GB2312 or GBK 点击获得Trackback地址,Encode: BIG5
发表评论:( 来了就留个脚印吧!你的参与是我最大的动力!)