level 3
梦①柯南
楼主
<?php
session_start();
header("Content-Type:text/html;charset=gb2312");
require_once "../model/indent.class.php";
$mysql=new indent();
//获取从易宝支付网关返回的信息
if(empty($_REQUEST['r0_Cmd']) || empty($_REQUEST['hmac']) ) die("<script>alert('违法操作');window.location.href='home.php';</script>");
$p1_MerId="10001126856";
$r0_Cmd=$_REQUEST['r0_Cmd'];
$r1_Code=$_REQUEST['r1_Code'];
$r2_TrxId=$_REQUEST['r2_TrxId'];
$r3_Amt=$_REQUEST['r3_Amt'];
$r4_Cur=$_REQUEST['r4_Cur'];
$r5_Pid=$_REQUEST['r5_Pid'];
$r6_Order=$_REQUEST['r6_Order'];
$r7_Uid=$_REQUEST['r7_Uid'];
$r8_MP=$_REQUEST['r8_MP'];
$r9_BType=$_REQUEST['r9_BType'];
$hmac=$_REQUEST['hmac'];
//拼接
$res_src="";
$res_src=$res_src.$p1_MerId;
$res_src=$res_src.$r0_Cmd;
$res_src=$res_src.$r1_Code;
$res_src=$res_src.$r2_TrxId;
$res_src=$res_src.$r3_Amt;
$res_src=$res_src.$r4_Cur;
$res_src=$res_src.$r5_Pid;
$res_src=$res_src.$r6_Order;
$res_src=$res_src.$r7_Uid;
$res_src=$res_src.$r8_MP;
$res_src=$res_src.$r9_BType;
$merchantKey ="69cl522AV6q613Ii4W6u8K6XuW8vM1N6bFgyv769220IuYe9u37N4y7rI4Pl";
//对返回的结果进行MD5-hmac加密处理,和返回的hmac签名串比较
if($mysql->HmacMd5($res_src,$merchantKey)==$hmac)
{
if($r1_Code==1)
{
if($r9_BType==1)
{
$array=$mysql->indentStatus($r6_Order); //获取订单状态
if(iconv("UTF-8","GB2312",$array["indentStatus"])!="待付款") die("<script>alert('交易成功,订单已完成');location.href='home.php';</script>");
$query=$mysql->updateIndentStatus($r6_Order); //修改订单状态
if($query==0) die("<script>alert('交易失败');location.href='home.php';</script>");
if($query==2) die("<script>alert('没有影响到订单状态或不存在该订单');location.href='home.php';</script>");
die("<script>alert('支付成功订单号{$r6_Order}');location.href='home.php';</script>");
}
else if($r9_BType==2){
echo "success";
$mysql->updateIndentStatus($r6_Order); //修改订单状态
}
}
}//判断是否密匙是否正确
else
{
die("<script>alert('签名被篡改了');location.href='home.php';</script>");
//
}
?>
2014年05月29日 14点05分
1
session_start();
header("Content-Type:text/html;charset=gb2312");
require_once "../model/indent.class.php";
$mysql=new indent();
//获取从易宝支付网关返回的信息
if(empty($_REQUEST['r0_Cmd']) || empty($_REQUEST['hmac']) ) die("<script>alert('违法操作');window.location.href='home.php';</script>");
$p1_MerId="10001126856";
$r0_Cmd=$_REQUEST['r0_Cmd'];
$r1_Code=$_REQUEST['r1_Code'];
$r2_TrxId=$_REQUEST['r2_TrxId'];
$r3_Amt=$_REQUEST['r3_Amt'];
$r4_Cur=$_REQUEST['r4_Cur'];
$r5_Pid=$_REQUEST['r5_Pid'];
$r6_Order=$_REQUEST['r6_Order'];
$r7_Uid=$_REQUEST['r7_Uid'];
$r8_MP=$_REQUEST['r8_MP'];
$r9_BType=$_REQUEST['r9_BType'];
$hmac=$_REQUEST['hmac'];
//拼接
$res_src="";
$res_src=$res_src.$p1_MerId;
$res_src=$res_src.$r0_Cmd;
$res_src=$res_src.$r1_Code;
$res_src=$res_src.$r2_TrxId;
$res_src=$res_src.$r3_Amt;
$res_src=$res_src.$r4_Cur;
$res_src=$res_src.$r5_Pid;
$res_src=$res_src.$r6_Order;
$res_src=$res_src.$r7_Uid;
$res_src=$res_src.$r8_MP;
$res_src=$res_src.$r9_BType;
$merchantKey ="69cl522AV6q613Ii4W6u8K6XuW8vM1N6bFgyv769220IuYe9u37N4y7rI4Pl";
//对返回的结果进行MD5-hmac加密处理,和返回的hmac签名串比较
if($mysql->HmacMd5($res_src,$merchantKey)==$hmac)
{
if($r1_Code==1)
{
if($r9_BType==1)
{
$array=$mysql->indentStatus($r6_Order); //获取订单状态
if(iconv("UTF-8","GB2312",$array["indentStatus"])!="待付款") die("<script>alert('交易成功,订单已完成');location.href='home.php';</script>");
$query=$mysql->updateIndentStatus($r6_Order); //修改订单状态
if($query==0) die("<script>alert('交易失败');location.href='home.php';</script>");
if($query==2) die("<script>alert('没有影响到订单状态或不存在该订单');location.href='home.php';</script>");
die("<script>alert('支付成功订单号{$r6_Order}');location.href='home.php';</script>");
}
else if($r9_BType==2){
echo "success";
$mysql->updateIndentStatus($r6_Order); //修改订单状态
}
}
}//判断是否密匙是否正确
else
{
die("<script>alert('签名被篡改了');location.href='home.php';</script>");
//
}
?>