HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/web/homefly/vsadmin/ncconfirm.asp
<%@LANGUAGE="VBScript"%>
<!--#include file="db_conn_open.asp"-->
<!--#include file="includes.asp"-->
<!--#include file="inc/incfunctions.asp"-->
<%
Dim str, OrderID, Txn_id, Payment_status, stockManage, objHttp
' read post from PayPal system and add 'cmd'
str = Request.Form
' assign posted variables to local variables
Receiver_email = Replace(Request.Form("to_email"),"'","")
Payment_gross = Replace(Request.Form("amount"),"'","")
Payer_email = Replace(Request.Form("from_email"),"'","")
OrderID = Replace(Request.Form("order_id"),"'","")
Txn_id = Replace(Request.Form("transaction_id"),"'","")

' post back to NOCHEX system to validate
set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHttp.open "POST", "https://www.nochex.com/nochex.dll/apc/apc", false
objHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHttp.Send str

' Check notification validation
if (objHttp.status <> 200 ) then
' HTTP error handling
elseif (objHttp.responseText = "AUTHORISED") then
	' check that Payment_status=Completed
	' check that Txn_id has not been previously processed
	' check that Receiver_email is an email address in your PayPal account
	' process payment
	Set rs = Server.CreateObject("ADODB.RecordSet")
	Set cnn=Server.CreateObject("ADODB.Connection")
	cnn.open sDSN
	sSQL="SELECT adminStockManage FROM admin WHERE adminID=1"
	rs.Open sSQL,cnn,0,1
	stockManage=Int(rs("adminStockManage"))
	rs.Close
	do_stock_management(trim(OrderID))
	sSQL="UPDATE cart SET cartCompleted=1 WHERE cartOrderID="&trim(OrderID)
	cnn.Execute(sSQL)
	sSQL="UPDATE orders SET ordAuthNumber='"&Txn_id&"' WHERE ordID="&trim(OrderID)
	cnn.Execute(sSQL)
elseif (objHttp.responseText = "DECLINED") then
' log for manual investigation
else 
' error
end if
set objHttp = nothing
%>