payend.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. define('IN_MYMPS', true);
  3. define('IN_ADMIN', true);
  4. define('CURSCRIPT', 'payend');
  5. require_once dirname(__FILE__) . '/../../../include/global.php';
  6. require_once MYMPS_DATA . '/config.php';
  7. require_once MYMPS_DATA . '/config.db.php';
  8. require_once MYMPS_INC . '/db.class.php';
  9. require_once MYMPS_INC . '/member.class.php';
  10. if (!$member_log->chk_in()) {
  11. write_msg('', '../' . $mymps_global['cfg_member_logfile'] . '?url=' . urlencode(GetUrl()));
  12. }
  13. $editor = 1;
  14. $paytype = 'tenpay';
  15. $payr = $db->getRow('SELECT * FROM ' . $db_mymps . 'payapi WHERE paytype=\'' . $paytype . '\'');
  16. $bargainor_id = $payr['payuser'];
  17. $key = $payr['paykey'];
  18. import_request_variables('gpc', 'frm_');
  19. $strCmdno = $frm_cmdno;
  20. $strPayResult = $frm_pay_result;
  21. $strPayInfo = $frm_pay_info;
  22. $strBillDate = $frm_date;
  23. $strBargainorId = $frm_bargainor_id;
  24. $strTransactionId = $frm_transaction_id;
  25. $strSpBillno = $frm_sp_billno;
  26. $strTotalFee = $frm_total_fee;
  27. $strFeeType = $frm_fee_type;
  28. $strAttach = $frm_attach;
  29. $strMd5Sign = $frm_sign;
  30. $strCreateIp = $frm_spbill_create_ip;
  31. $checkkey = 'cmdno=' . $strCmdno . '&pay_result=' . $strPayResult . '&date=' . $strBillDate . '&transaction_id=' . $strTransactionId . '&sp_billno=' . $strSpBillno . '&total_fee=' . $strTotalFee . '&fee_type=' . $strFeeType . '&attach=' . $strAttach . '&spbill_create_ip=' . $strCreateIp . '&key=' . $key;
  32. $checkSign = strtoupper(md5($checkkey));
  33. if ($bargainor_id != $strBargainorId) {
  34. write_msg('错误的商户号.', 'olmsg');
  35. }
  36. if ($strPayResult == '0') {
  37. include MYMPS_INC . '/pay.fun.php';
  38. $orderid = $strSpBillno;
  39. $ddno = $strAttach;
  40. $money = $strTotalFee / 100;
  41. $paybz = '支付完成';
  42. UpdatePayRecord($ddno, $paybz);
  43. write_msg('您已成功充值 ' . $money * $mymps_global['cfg_coin_fee'] . ' 个金币', $mymps_global['SiteUrl'] . '/member/index.php?m=pay&ac=record');
  44. }
  45. else {
  46. write_msg('支付失败.', 'olmsg');
  47. }
  48. is_object($db) && $db->Close();
  49. $mymps_global = NULL;
  50. ?>