Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
The script that follows is intended to run when
it is invoked by Paypal's IPN (Instant Payment
Notification) but I have (somehow) broken it
and despite repeated attempts cannot fix it.
Can anyone PLEASE check this for me to see
where the problem lies? ( I have overwritten
some security-sensitive content with xxx...)
//get global configuration information
require '../xxxxx/A.php';require
'../xxxxxx/B.php';include '../xxxxxx/C.php';
//get pay pal configuration file
//php compiled with libCurl support
$paypalurl="http://www.paypal.com/cgi-
bin/webscr";
$result=libCurlPost($paypalurl,$_POST);
$paypalcurl_location="/usr/bin/curl";
//check the ipn result received back from
paypal
if(eregi("VERIFIED",$result))
{$OrderNo=$_POST['invoice'];$txid=$_POST['txid'
];$_POST['receiver_email']=$email
if(empty($OrderNo)){exit;}
else{
if(empty($txid)){exit;}
else{
if($email='xxxxxxxxxxxxxx'){exit;}
else{
$dat=mysqli_query($X,"SELECT od_status FROM
tbl_order WHERE od_id='$OrderNo' AND
(od_txid='' OR od_txid IS NULL)");
$num=mysqli_num_rows($dat);
//if no invoice with such number is found, exit
if($num == 0){exit;}
else{
$dat=mysqli_query($X,"SELECT
od_total,od_session_id FROM tbl_order WHERE
od_id='$OrderNo'");
while($sql=mysqli_fetch_array($dat))
{$sessid=$sql['od_session_id'];$sessOver='XX'.$
sessid;};
//if(!get_magic_quotes_gpc()){$memo =
addslashes($memo);};
$memo='Auto update from script';
mysqli_query($X,"UPDATE tbl_order SET
od_status='Completed',od_memo='$memo',od_last_u
pdate=NOW(),od_txid='$txid',od_session_id='$ses
sOver' WHERE od_id='$OrderNo'");mysqli_query($X,"UPDATE tbl_order_item SET
od_session_id='$sessOver' WHERE
od_id='$OrderNo'");$qry=mysqli_query($X,"SELECT od_id,pd_id,od_qty
FROM tbl_order_item WHERE od_id='$OrderNo'");
while($sql=mysqli_fetch_array($qry)){$pdid=$sql
['pd_id'];$odqty=$sql['od_qty'];
//update product stock
mysqli_query($X,"UPDATE stock SET
quantity=quantity-'$odqty' WHERE
stockref='$pdid'");
//update web page inclusion parameter if all of
a style is sold
$dat=mysqli_query($X,"SELECT quantity FROM
stock WHERE stockref='$pdid'");
while($inqry=mysqli_fetch_array($dat)){
if($inqry['quantity']<1){
$leftprodref=substr($pdid,0,strcspn($pdid,
"0123456789")+2);
$upd=mysqli_query($X,"SELECT SUM(quantity) FROM
stock WHERE stockref LIKE '$leftprodref%'");
while($upqry=mysqli_fetch_array($upd)){
if($upqry['SUM(quantity)']==0){mysqli_query(X,"
UPDATE WebDetails SET
WebPageActive='0',RecentAddition='0' WHERE
Stockref='$leftprodref'");}
;}
;}
;}
;}
;}
;}
;}
;}
;}
else
{include
'http://www.xxxxxx/xxxxxx/ipn_error.php';}

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |