<?php
// 公共函数定义
  function HexToStr($hex)
  {
     $string="";
     for ($i=0;$i<strlen($hex)-1;$i+=2)
         $string.=chr(hexdec($hex[$i].$hex[$i+1]));
     return $string;
  } 
  
  
  $m_id	= $_POST['m_id'];	//商家号	
  $payid = $_POST['m_orderid']; //商家订单号
  $amount = $_POST['m_oamount']; //支付金额
  $m_status = $_POST['m_status'];  //支付状态2成功,3失败
  //接收组件的加密
  $OrderInfo	=	$_POST['OrderMessage'];			//订单加密信息
  $signMsg 	=	$_POST['Digest'];				//密匙
  //接收md5加密认证
  $md5info	=	$_POST['md5info'];
  
  $signMsg = $_POST["digest"];
  $OrderInfo = HexToStr($OrderInfo);

  $key = $this->ikey;
  $digest = strtoupper(md5($OrderInfo.$key));

if ($md5info == $md5info) {
		
	if($m_status=="2") {	

			$PageMain=Insert_Back_value($payid,$amount);

	}else{

			$PageMain=err("支付失败!","member.php","");

	}

}else{
	
			$PageMain=err("签名认证错误!","member.php","");


}

?>
