首頁 > php教程 > PHP源码 > 主體

蜘蛛统计php版

PHP中文网
發布: 2016-05-25 17:09:52
原創
5378 人瀏覽過

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
熱門推薦
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板