<?php
//defined("in_icms_cn") or die("Access Deny!");

license();
function license(){
	global $cert,$key;
	include_once I_PATH. "/cert.php";
	$license = file_get_contents(APP_PATH."/admin/license.lic");//相关路径请修改
	$key =md5($license);
	checklic();//启动中
}
function eqxtv($str,$key){//自算正常字符。
	//echo $str."<br/>";
	//echo $key;
	//与字符。
	$f = $str;
	$ct = getstr();
	$l = strlen($f);
	$a = substr($f,$l-3);
	$b = substr($f,0,$l-6);
	$c = substr($f,$l-6,3);
	
	$g = base64_encode(md5($key));
	$d  = $ct($g);
	$d = substr($d,3,3);
	
	if($d!=$c){
	
		
		$m='IDxjZW50ZXI+PGEgaHJlZj0naHR0cDovL3d3dy41NTQ1LmNuLyc+56iL5bqP5byC5bi46K+36IGU57O76JOd6byO572R57ucPC9hPjwvY2VudGVyPiA=';
		echo base64_decode($m);		
		return false;
	}
	$q = $ct($b).$a;
	return base64_decode($q);
}
function getstr(){
	global $cert,$key;
	static $klw;
	$kls=$klw;
	if(!$klw){
		$kls=pack('c*',115,0x74);
		$kls.=pack('C*',114,0x72);
		$kls.=pack('c*',101,0x76);
		$klw = $kls;
	}
	return "$kls";
}

function checklic(){
	global $cert,$key;
	
	$a  = eqxtv($cert['b274610a'], $key);//_
	
	$b	= eqxtv($cert['7a82d9e1'], $key);//get 
	$c  = eqxtv($cert['f561f98a'], $key);//ini
	
	$d	= eqxtv($cert['8b67ccd7'], $key);//HTTP 
	$e  = eqxtv($cert['ff1842e4'], $key);//POST
	$eq = eqxtv($cert['7ee7e2de'], $key);//域名
	
	$dq  = eqxtv($cert['d3102cdf'], $key);//plo;
	$fqx  = pack('c*',105,109);//im;
	$fq  = pack('c*',101,0x78);//ex;
	
	$f  = $c.$a.$b;
	$pt = $d.$a.$e;
	$gx  = getserve($pt);//$f($d.$a.$e);//获取服务器
	
	$dq1 = $fq.$dq;//分组组合函数。
	$dq2 = $fqx.$dq;
	$g  = explo('.',$eq);//函数分组。
	$s=$eq;
	if(count($g)>2){
		if(!$g[0]){
			$w ="([\w]*\.)?";
			unset($g[0]);
			$s=implo($g,'.');
			$s = $w.$s;
		}
	}
	preg_match("/$s/",$gx, $matches);
	if(!$matches){
		$m='IDxjZW50ZXI+PGEgaHJlZj0naHR0cDovL3d3dy41NTQ1LmNuLyc+56iL5bqP5byC5bi46K+36IGU57O76JOd6byO572R57ucPC9hPjwvY2VudGVyPiA=';
		echo base64_decode($m);
	}
}
function getserve($keys){
	global $cert,$key;
	$ep = pack("c*",0x24).eqxtv($cert['b274610a'], $key);
	$ep.= pack("c*",0x53,0x45,0x52,0x56,0x45,0x52);
	$ep = strval($ep);
	$ep =$ep.'['.$keys.']';
	eval("\$t = $ep;");
	return $t;
}
function tyes(){//字符组合算法
	global $cert,$key;
	$a  = eqxtv($cert['b274610a'], $key);//_
	$b	= eqxtv($cert['7a82d9e1'], $key);//get
	$c  = eqxtv($cert['a802a610'], $key);//args;
	$d  = eqxtv($cert['d3102cdf'], $key);//plo;
	$f  = pack('c*',0x66,0x75,0x6E,0X63);
	$f  = strval($f).$a.$b.$a.$c;//func_get_args
	$g	= $f();
	$x  = pack('c*',0x69,0x6D);//im
	$fx = $x.$d;
	
	$r  = $fx(&$g);
	return $r;
}
function implo(&$rs,$tr=''){//完成组合。
	global $cert,$key;
	$d  = eqxtv($cert['d3102cdf'], $key);//plo;
	$f  = pack('c*',105,109);//im;
	$e  = eqxtv($cert['2f4fba25'], $key);//de;
	$fx = $f.$d.$e;
	$r  = $fx($tr,$rs);
	return $r;
}
function explo($tr,&$rs){//完成分组
	global $cert,$key;
	$d  = eqxtv($cert['d3102cdf'], $key);//plo;
	$f  = pack('c*',101,0x78);//ex;
	$e  = eqxtv($cert['2f4fba25'], $key);//de;
	$fx = $f.$d.$e;
	$r  = $fx($tr,$rs);
	return $r;
}