- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>无标题文档</title>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <link rel="stylesheet" type="text/css" href="/c3.css" />
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <meta http-equiv="Content-Language" content="zh-cn" />
- <meta name="robots" content="all" />
- <meta name="author" content="lunanzuche.com" />
- <meta name="Copyright" content="Copyright www.lunanzuche.com All Rights Reserved." />
- <meta name="MSSmartTagsPreventParsing" content="true" />
- <meta http-equiv="p_w_picpathtoolbar" content="false" />
- </head>
- <body>
- <?PHP
- /**
- * 判断是否为搜索引擎蜘蛛
- *
- * @author Eddy
- * @return bool
- */
- function isCrawler(){
- $agent= strtolower($_SERVER['HTTP_USER_AGENT']);
- if (!empty($agent)) {
- $spiderSite= array(
- "TencentTraveler",
- "Baiduspider+",
- "BaiduGame",
- "Googlebot",
- "msnbot",
- "Sosospider+",
- "Sogou web spider",
- "ia_archiver",
- "Yahoo! Slurp",
- "YoudaoBot",
- "Yahoo Slurp",
- "MSNBot",
- "Java (Often spam bot)",
- "BaiDuSpider",
- "Voila",
- "Yandex bot",
- "BSpider",
- "twiceler",
- "Sogou Spider",
- "Speedy Spider",
- "Google AdSense",
- "Heritrix",
- "Python-urllib",
- "Alexa (IA Archiver)",
- "Ask",
- "Exabot",
- "Custo",
- "OutfoxBot/YodaoBot",
- "yacy",
- "SurveyBot",
- "legs",
- "lwp-trivial",
- "Nutch",
- "StackRambler",
- "The web archive (IA Archiver)",
- "Perl tool",
- "MJ12bot",
- "Netcraft",
- "MSIECrawler",
- "WGet tools",
- "larbin",
- "Fish search",
- );
- foreach($spiderSite as $val) {
- $str = strtolower($val);
- if (strpos($agent, $str) !== false) {
- return true;
- }
- }
- }else {
- return false;
- }
- }
- ?>
- </body>
- </html>
以上主要就是根据函数进行判断