query_result.asp
上传用户:btntkt
上传日期:2021-04-16
资源大小:5296k
文件大小:2k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

DOS

  1. <!-- #include file="conn.asp" -->
  2. <!-- #include file="asp_md5.asp" -->
  3. <meta name="TENCENT_ONELINE_PAYMENT" content="China TENCENT">
  4. <html>
  5. <%    exec="select * from webinfo"
  6.       set rs=server.createobject("adodb.recordset")
  7.       rs.open exec,conn,1,3
  8.       tenpayid=rs("tenpayid")
  9.       tenpaypin=rs("tenpaypin")
  10.       tenpayurl=rs("tenpayurl")
  11.       payall=session("payall")
  12.   dingdan=session("dingdan")
  13.   des=rs("webname")
  14. %>
  15. <%
  16. '取返回参数(财付通将会用Post方式请求该页面)
  17. cmdno = Request("cmdno")
  18. pay_result = Request("pay_result")
  19. pay_info = Request("pay_info")
  20. bill_date = Request("date")
  21. bargainor_id = Request("bargainor_id")
  22. transaction_id = Request("transaction_id")
  23. sp_billno = Request("sp_billno")
  24. total_fee = Request("total_fee")
  25. fee_type = Request("fee_type")
  26. attach = Request("attach")
  27. md5_sign = Request("sign")
  28. '本地参数
  29. spid = tenpayid ' 这里替换为您的实际商户号
  30. sp_key = tenpaypin ' sp_key是32位商户密钥, 请替换为您的实际密钥
  31. '返回值定义
  32. Private Const retOK = 0 ' 成功
  33. Private Const invalidSpid = 1 ' 商户号错误
  34. Private Const invalidSign = 2 ' 签名错误
  35. Private Const tenpayErr = 3 ' 财付通返回支付失败
  36. '验签函数
  37. Function verifyMd5Sign
  38. origText = "cmdno=" & cmdno & "&pay_result=" & pay_result &_ 
  39.      "&date=" & bill_date & "&transaction_id=" & transaction_id &_
  40.    "&sp_billno=" & sp_billno & "&total_fee=" & total_fee &_
  41.    "&fee_type=" & fee_type & "&attach=" & attach &_
  42.    "&key=" & sp_key
  43. localSignText = UCase(ASP_MD5(origText)) ' 转换为大写
  44. verifyMd5Sign = (localSignText = md5_sign)
  45. End Function
  46. '返回值
  47. Dim retValue
  48. retValue = retOK
  49. '判断商户号
  50. If bargainor_id <> spid Then
  51. retValue = invalidSpid
  52. Else 
  53. ' 验签
  54. If verifyMd5Sign <> True Then
  55. retValue = invalidSign
  56. Else
  57. ' 检查财付通返回值
  58. If pay_result <> 0 Then
  59. retValue = tenpayErr
  60. End If
  61. End If
  62. End If
  63. ' 业务处理,修改数据库,向客户发送通知...
  64. Select Case retValue
  65. Case retOK pay_msg = "此单已成功支付!"
  66. Case invalidSpid pay_msg = "错误的商户号!"
  67. Case invalidSign pay_msg = "验证MD5签名失败!"
  68. Case Else pay_msg = "此单未支付!"
  69. End Select
  70. response.write pay_msg
  71. %>
  72. </html>