IPN现已禁用需要帮助解密asp代码

时间:2013-03-23 19:32:03

标签: asp-classic paypal-ipn

Paypal已发送电子邮件警告IPN失败。

我没有对我的代码进行任何更改,而且它真的是旧代码....已经工作了5年多......已经很久了,我必须在这个网站上做任何事情。

我搜索了服务器日志以获取更多信息......这是我反复发现的内容

|35|80040e14|Syntax_error_(missing_operator)_in_query_expression_'OrderID='.

我检查了网站的ipn页面上的代码,我很难过。 什么都没有改变,但它停止了工作

这是ipn页面代码的第34行到第36行:

MM_Cmd.CommandText = "UPDATE Orders SET txn_id='" & txn_id & "',payment_status='" & payment_status & "' WHERE OrderID=" & Item_number
MM_Cmd.Execute 
end function

更新: 以下是显示Item_number的完整代码:

<%
str = Request.Form & "&cmd=_notify-validate"

' post back to PayPal system to validate
set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", false
objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objHttp.Send str

' assign posted variables to local variables
Item_number = Request("item_number")
Payment_status = Request("payment_status")
Txn_id = Request("txn_id")
if (objHttp.status <> 200 ) then
' HTTP error handling
elseif (objHttp.responseText = "VERIFIED") then
if Payment_status = "Completed" then 'only update database if the response text is verified and the payment complete
UpdateOrder
end if
elseif (objHttp.responseText = "INVALID") then
' log for manual investigation
else
' error
end if

set objHttp = nothing

function UpdateOrder
'on error resume next
Set MM_Cmd = Server.CreateObject("ADODB.Command")
MM_Cmd.ActiveConnection = MM_CharonCart_STRING
MM_Cmd.CommandText = "UPDATE Orders SET txn_id='" & txn_id & "',payment_status='" & payment_status & "' WHERE OrderID=" & Item_number
MM_Cmd.Execute 
end function
%>

1 个答案:

答案 0 :(得分:0)

问题在于您的变量Item_number。如果您将查询结束重写为

,则很有可能
... where OrderID=" & Cint(Item_number)

那么你将解决你的问题,但你可能需要查看为Item_number分配值的代码