<?php
/* *
 * 功能：服务器同通知页面
 */
require_once("yun.config.php");
require_once("lib/yun_md5.function.php");
?>
<!DOCTYPE HTML>
<html>
    <head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
//计算得出通知验证结果
$yunNotify = md5Verify($_REQUEST['i1'],$_REQUEST['i2'],$_REQUEST['i3'],$yun_config['key'],$yun_config['partner']);
if($yunNotify) {//验证成功
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	//商户订单号

	$out_trade_no = $_REQUEST['i2'];

	//云支付交易号

	$trade_no = $_REQUEST['i4'];

	//价格
	$yunprice=$_REQUEST['i1'];
		$cm->query("SELECT * FROM phome_order as a left join phome_ecms_download as b on a.o_pid=b.id where a.o_orderid='".$out_trade_no."'");
		if($cm->db_num_rows($rs)==1){
		$orderinfo = $cm->fetch_array($rs);
		if($orderinfo['o_zt']=='0'){
			$cm->query("UPDATE phome_order SET o_zt='1' WHERE o_orderid='".$out_trade_no."'");
			$okm='234';
			
		}else{
			$okm='234';
		}
		}else{
			echo tiao('订单不存在，请联系管理核实！','/');	
		}

    /*
加入您的入库及判断代码;
判断返回金额与实金额是否想同;
判断订单当前状态;
完成以上才视为支付成功
*/
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
else {
    //验证失败
    echo tiao('支付失败，请联系管理核实！','/');
}
?>
        <title>云支付回调页面</title>
	</head>
    <body>
    <?
	if($okm=='234'){
		?>
        <style>
body {
	font: 12px/1.5 Verdana;
	color: #333;
	background: #f3f3f3;
}

.wind_wrap {
	width: 70%;
	margin: 50px auto;
	border: 1px solid #ccc;
	background: #fff;
}

.wind_wrap h1 {
	border-bottom: 1px solid #ccc;
	line-height: 40px;
	height: 40px;
	padding: 0 20px;
	margin: 0;
	font-size: 16px;
	background:#f9f9f9;
	background-repeat: no-repeat;
	background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), color-stop(25%, #ffffff), to(#f4f4f4));
	background-image: -webkit-linear-gradient(#ffffff, #ffffff 25%, #f4f4f4);
	background-image: -moz-linear-gradient(top, #ffffff, #ffffff 25%, #f4f4f4);
	background-image: -ms-linear-gradient(#ffffff, #ffffff 25%, #f4f4f4);
	background-image: -o-linear-gradient(#ffffff, #ffffff 25%, #f4f4f4);
	background-image: linear-gradient(#ffffff, #ffffff 25%, #f4f4f4);
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f4f4f4', GradientType=0);
}

.wind_wrap h1 span {
	color: #dd5925;
}

.wind_main {
	padding: 20px;
	line-height: 1.8;
}

.wind_wrap h2 {
	color: #dd5925;
	font-size: 14px;
	background: #f9eeea;
	margin-bottom: 10px;
	line-height: 25px;
	padding: 0 10px;
}

.wind_wrap h3 {
	padding-left: 24px;
	background: #f7f7f7;
	font-weight: 100;
	font-size: 12px;
	margin-bottom: 10px;
}

.wind_wrap ul {
	padding-left: 48px;
	margin-bottom: 10px;
}

.wind_wrap ul li:hover {
	background: #f3f3f3;
}

.wind_wrap .err {
	color: #ff0000;
	background: #faf6f4;
}

.wind_wrap .tips {
	padding: 5px 10px;
	background: #ffffe3;
	border: 1px solid #cccccc;
	line-height: 20px;
	color: #333;
}
</style>
<div class="wind_wrap">
<div class="wind_main">
<h2>恭喜你，你已成功订购《<?=$orderinfo['title']?>》</h2>
<div class="tips" style=" font-size:16px">
	<p>订单编号(建议保存)：<?=hifun($trade_no,'D','hifun')?></p>
	<p>商品下载地址：<?
    $myex=explode(':',$orderinfo['downpath']);
	if($myex[6]!=''){
		echo $myex[6].":".$myex[7];	
	}
	?></p>
    <p>提取密码：<?=$orderinfo['ppass']?></p>
    
</div>
</div>
</div>
        <?
	}
	?>
    </body>
</html>