首页 > php教程 > PHP源码 > 正文

蜘蛛统计php版

PHP中文网
发布: 2016-05-25 17:09:52
原创
5349 人浏览过

php代码

<?php
$useragent = addslashes(strtolower($_SERVER[&#39;HTTP_USER_AGENT&#39;]));
if (strpos($useragent, &#39;googlebot&#39;)!== false){$bot = &#39;Google&#39;;}
elseif (strpos($useragent,&#39;mediapartners-google&#39;) !== false){$bot = &#39;Google Adsense&#39;;}
elseif (strpos($useragent,&#39;baiduspider&#39;) !== false){$bot = &#39;Baidu&#39;;}
elseif (strpos($useragent,&#39;sogou spider&#39;) !== false){$bot = &#39;Sogou&#39;;}
elseif (strpos($useragent,&#39;sogou web&#39;) !== false){$bot = &#39;Sogou web&#39;;}
elseif (strpos($useragent,&#39;sosospider&#39;) !== false){$bot = &#39;SOSO&#39;;}
elseif (strpos($useragent,&#39;yahoo&#39;) !== false){$bot = &#39;Yahoo&#39;;}
elseif (strpos($useragent,&#39;msn&#39;) !== false){$bot = &#39;MSN&#39;;}
elseif (strpos($useragent,&#39;msnbot&#39;) !== false){$bot = &#39;msnbot&#39;;}
elseif (strpos($useragent,&#39;sohu&#39;) !== false){$bot = &#39;Sohu&#39;;}
elseif (strpos($useragent,&#39;yodaoBot&#39;) !== false){$bot = &#39;Yodao&#39;;}
elseif (strpos($useragent,&#39;twiceler&#39;) !== false){$bot = &#39;Twiceler&#39;;}
elseif (strpos($useragent,&#39;ia_archiver&#39;) !== false){$bot = &#39;Alexa_&#39;;}
elseif (strpos($useragent,&#39;iaarchiver&#39;) !== false){$bot = &#39;Alexa&#39;;}
elseif (strpos($useragent,&#39;slurp&#39;) !== false){$bot = &#39;雅虎&#39;;}
elseif (strpos($useragent,&#39;bot&#39;) !== false){$bot = &#39;其它蜘蛛&#39;;}
if(isset($bot)){
$fp = @fopen(&#39;bot.txt&#39;,&#39;a&#39;);
fwrite($fp,date(&#39;Y-m-d H:i:s&#39;)."\t".$_SERVER["REMOTE_ADDR"]."\t".$bot."\t".&#39;http://&#39;.$_SERVER[&#39;SERVER_NAME&#39;].$_SERVER["REQUEST_URI"]."\r\n");
fclose($fp);
}
?>
登录后复制
相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门推荐
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!