Computing.Net > Forums > Programming > PHP MySQL Help needed

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

PHP MySQL Help needed

Reply to Message Icon

Name: Mike
Date: January 25, 2009 at 11:58:45 Pacific
OS: Windows XP
CPU/Ram: Intel Duo 2GB RAM
Product: Intel / ??
Subcategory: General
Comment:

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';}



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: PHP MySQL Help needed

php/mysql help! www.computing.net/answers/programming/phpmysql-help/8007.html

PHP/MySQL check if table exist www.computing.net/answers/programming/phpmysql-check-if-table-exist/10938.html

Cascade Combo PHP/MYSQL www.computing.net/answers/programming/cascade-combo-phpmysql/11682.html