新科技之美女搜索引擎 PHP判断搜索引擎蜘蛛并自动记忆到文件的代码
复制代码 代码如下:
function write_naps_bot(){
$useragent=get_naps_bot();
// echoExit($useragent);
if ($useragent=="false") return FALSE ;
date_default_timezone_set("Asia/Shanghai");
$date=date("Y-m-d H:i:s");
$ip=$_SERVER[REMOTE_ADDR];
$url="http://".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI];
// echoExit($url);转载注明www.chhua.com
if (!file_exists("./log/bot.html")){
$botfile=fopen("./log/bot.html", "w");
$fileHeader="
访问查看
删除日志
";
// echoExit($botfile);转载注明www.chhua.com
fputs($botfile, $fileHeader);
fclose($botfile);
}else
{ $filesize=filesize("./log/bot.html");
if ($filesize>=100000){
$botfile=fopen("./log/bot.html", "w");
$fileHeader="
访问查看
删除日志
";
fputs($botfile, $fileHeader);
fclose($botfile);
}else {
$botfile=fopen("./log/bot.html", "a ");
}
//$size=" 当前文件大小为:".$filesize."
";转载注明www.chhua.com
$useragent=" USER:".$useragent."
";
$date=" TIME:".$date."
";
$ip=" IP:".$ip."
";
$url=" URL:".$url."
";
$fileStr=$useragent.$date.$ip.$url;
fputs($botfile, $fileStr);
fclose($botfile);
}
}
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 'So**ot';
}
if(strpos($useragent, 'lycos') !== false){
return 'Lycos';
}
if(strpos($useragent, 'robozilla') !== false){
return 'Robozilla';
}
return "false";
}
以上就介绍了新科技之**搜索引擎 PHP判断搜索引擎蜘蛛并自动记忆到文件的代码,包括了新科技之**搜索引擎方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
大家都在看:
应对现代浏览器限制:在网页中引导用户添加书签的实践指南 PHP如何向数组添加元素_PHP向数组中添加新元素的多种技巧 基于浏览器指纹识别技术实现跨浏览器设备**标识 利用浏览器指纹技术**识别计算机:构建跨浏览器通信的解决方案 解决PHP中“Undefined Index”错误的类型声明技巧
上文是新科技之**搜索引擎 PHP判断搜索引擎蜘蛛并自动记忆到文件的代码的内容了,文章的版权归原作者所有,如有侵犯您的权利,请及时联系本站删除,更多相关新科技之**搜索引擎的资讯,请关注收藏本站。
本文地址:https://www.31p.net/gljc/250821.html
文章标题:新科技之美女搜索引擎 PHP判断搜索引擎蜘蛛并自动记忆到文件的代码
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。







