payend.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. require("../../class/connect.php");
  3. require("../../class/db_sql.php");
  4. require("../../class/q_functions.php");
  5. require("../../member/class/user.php");
  6. eCheckCloseMods('pay');//关闭模块
  7. $link=db_connect();
  8. $empire=new mysqlquery();
  9. $editor=1;
  10. //订单号
  11. if(!getcvar('checkpaysession'))
  12. {
  13. printerror('非法操作','../../../',1,0,1);
  14. }
  15. else
  16. {
  17. esetcookie("checkpaysession","",0);
  18. }
  19. //操作事件
  20. $phome=getcvar('payphome');
  21. if($phome=='PayToFen')//购买点数
  22. {}
  23. elseif($phome=='PayToMoney')//存预付款
  24. {}
  25. elseif($phome=='ShopPay')//商城支付
  26. {}
  27. elseif($phome=='BuyGroupPay')//购买充值类型
  28. {}
  29. else
  30. {
  31. printerror('您来自的链接不存在','',1,0,1);
  32. }
  33. $user=array();
  34. if($phome=='PayToFen'||$phome=='PayToMoney'||$phome=='BuyGroupPay')
  35. {
  36. $user=islogin();//是否登陆
  37. }
  38. $paytype='chinabank';
  39. $payr=$empire->fetch1("select * from {$dbtbpre}enewspayapi where paytype='$paytype' limit 1");
  40. if(!$payr['payid']||$payr['isclose'])
  41. {
  42. printerror('您来自的链接不存在','',1,0,1);
  43. }
  44. $v_mid=$payr['payuser'];//商户号
  45. $key=$payr['paykey'];//密钥
  46. //----------------------------------------------返回信息
  47. $v_oid =trim($_POST['v_oid']);
  48. $v_pmode =trim($_POST['v_pmode']);
  49. $v_pstatus=trim($_POST['v_pstatus']);
  50. $v_pstring=trim($_POST['v_pstring']);
  51. $v_amount=trim($_POST['v_amount']);
  52. $v_moneytype =trim($_POST['v_moneytype']);
  53. $remark1 =trim($_POST['remark1']);
  54. $remark2 =trim($_POST['remark2']);
  55. $v_md5str =trim($_POST['v_md5str']);
  56. //md5
  57. $md5string=strtoupper(md5($v_oid.$v_pstatus.$v_amount.$v_moneytype.$key));
  58. if('dg'.$v_md5str!='dg'.$md5string)
  59. {
  60. printerror('验证MD5签名失败.','../../../',1,0,1);
  61. }
  62. if($v_pstatus!="20")
  63. {
  64. printerror('支付失败.','../../../',1,0,1);
  65. }
  66. //----------- 支付成功后处理 -----------
  67. include('../payfun.php');
  68. $pr=$empire->fetch1("select paymoneytofen,payminmoney from {$dbtbpre}enewspublic limit 1");
  69. $orderid=$v_oid; //支付订单
  70. $ddno=$remark1; //网站的订单号
  71. $money=$v_amount;
  72. $fen=floor($money)*$pr[paymoneytofen];
  73. if($phome=='PayToFen')//购买点数
  74. {
  75. $paybz='购买点数: '.$fen;
  76. PayApiBuyFen($fen,$money,$paybz,$orderid,$user[userid],$user[username],$paytype);
  77. }
  78. elseif($phome=='PayToMoney')//存预付款
  79. {
  80. $paybz='存预付款';
  81. PayApiPayMoney($money,$paybz,$orderid,$user[userid],$user[username],$paytype);
  82. }
  83. elseif($phome=='ShopPay')//商城支付
  84. {
  85. include('../../data/dbcache/class.php');
  86. $ddid=(int)getcvar('paymoneyddid');
  87. $paybz='商城购买 [!--ddno--] 的订单(ddid='.$ddid.')';
  88. PayApiShopPay($ddid,$money,$paybz,$orderid,'','',$paytype);
  89. }
  90. elseif($phome=='BuyGroupPay')//购买充值类型
  91. {
  92. include("../../data/dbcache/MemberLevel.php");
  93. $bgid=(int)getcvar('paymoneybgid');
  94. PayApiBuyGroupPay($bgid,$money,$orderid,$user[userid],$user[username],$user[groupid],$paytype);
  95. }
  96. db_close();
  97. $empire=null;
  98. ?>