<?php
require dirname(__FILE__) . "/dzsck.php";
include('../inc/aik.config.php');
/**
 * ---------------------支付成功，用户会跳转到这里-------------------------------
 * 
 * 此页就是您之前传给pay.paysapi.com的return_url页的网址
 * 支付成功，PaysApi会把用户跳转回这里。
 * 
 * --------------------------------------------------------------
 */

    $orderid = $_GET["orderid"];
	//$isql="update d_ddcenter set dd_type=1 where dd_order='".$orderid."'";
    //$ddinfo=mysql_query($isql);
	//$cm->query("SELECT * FROM d_ddcenter where dd_order='" . $orderid . "'");
	//$row = $cm->fetch_array($rs);
	//$dd_adminid=$row['dd_adminid'];
	echo $orderid;
	$cm->query("SELECT * FROM d_ddcenter where dd_order='" . $orderid . "' order by dd_id desc");
    $km_number = $cm->fetch_array($rs);
	$cm->query("SELECT * FROM d_adminuser where admin_id='" . $km_number["dd_adminid"] . "'    ");
    $km_number3 = $cm->fetch_array($rs);
		if($km_number["dd_vip"]==1){
           if( $km_number3['admin_endtime']<time())$ddvip = $cm->query("UPDATE d_adminuser SET admin_endtime=".time()."+2678400,admin_level=1,admin_opentime='".$nowtime."' WHERE admin_id='" . $km_number["dd_adminid"] . "'");
           else $ddvip = $cm->query("UPDATE d_adminuser SET admin_endtime=admin_endtime+2678400,admin_level=1,admin_opentime='".$nowtime."' WHERE admin_id='" . $km_number["dd_adminid"] . "'");
	        }
/*******季度会员*****/
       else if($km_number["dd_vip"]==2){
	 	   if( $km_number3['admin_endtime']<time())$ddvip = $cm->query("UPDATE d_adminuser SET admin_endtime=".time()."+8035200,admin_level=2,admin_opentime='".$nowtime."' WHERE admin_id='" . $km_number["dd_adminid"] . "'");
	 	   else $ddvip = $cm->query("UPDATE d_adminuser SET admin_endtime=admin_endtime+8035200,admin_level=2,admin_opentime='".$nowtime."' WHERE admin_id='" . $km_number["dd_adminid"] . "'");
	       }
/*******年度会员*****/
       else if($km_number["dd_vip"]==3){
	 	 if( $km_number3['admin_endtime']<time())$ddvip = $cm->query("UPDATE d_adminuser SET admin_endtime=".time()."+31536000,admin_level=3,admin_opentime='".$nowtime."' WHERE admin_id='" . $km_number["dd_adminid"] . "'");
	 	 else $ddvip = $cm->query("UPDATE d_adminuser SET admin_endtime=admin_endtime+31536000,admin_level=3,admin_opentime='".$nowtime."' WHERE admin_id='" . $km_number["dd_adminid"] . "'");
	       }
        $agree=$cm->query("UPDATE d_ddcenter SET dd_type=1 WHERE dd_order ='" .$orderid. "'");
    //此处在您数据库中查询：此笔订单号是否已经异步通知给您付款成功了。如成功了，就给他返回一个支付成功的展示。
    //echo "恭喜，支付成功!，订单号：".$orderid;
	echo tiao("订单递交成功，正在审核！", "ddcenter.php");
    exit();
    

?>