代码简单了点。将就着看吧。
这个页面如果是来xxs100.com的访问,将自动跳到广告示例页面
<?php
/*
Copyright (c) 2008-2018 www.xxs100.com
*/
if (isCrawler()){
// echo "你好蜘蛛精!";
header("location:index2.html");
include template('index2');
include "index2.html";
}
else{
// echo "你不是蜘蛛精啊!";
}
function isCrawler() {
echo $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;
}
}
?>
下边是跳转代码
<script type="text/javascript">
var regexp=/\.(xxs100|soso|baidu|google|youdao|yahoo|bing|so|mydigit|gougou|sm|bokee)(\.[a-z0-9\-]+){1,2}\//ig;
var where =document.referrer;
if(regexp.test(where))
{
setTimeout(function(){window.location.href='http://php.xxs100.com/ads1.html'},3000);
}
</script>
本文地址:
/show-357.html
版权声明:除非特别标注原创,其它均来自互联网,转载时请以链接形式注明文章出处。