Rumah > php教程 > PHP源码 > teks badan

蜘蛛统计php版

PHP中文网
Lepaskan: 2016-05-25 17:09:52
asal
5372 orang telah melayarinya

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);
}
?>
Salin selepas log masuk
Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Cadangan popular
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan