$itemArr = array(); $id = $_SESSION["id"]; $query = "SELECT txn_id, PROD_NAME, purchase_date, quantity,bz_bookstore.id FROM shop_ipn,bz_bookstore WHERE user_id = '{$id}' AND shop_ipn.upc = bz_bookstore.upc"; $result = mysql_query($query); $i = 0; while ($row = mysql_fetch_assoc($result)) { $itemArr[$i]["txn_id"] = $row["txn_id"]; $itemArr[$i]["PROD_NAME"] = $row["PROD_NAME"]; $itemArr[$i]["purchase_date"] = $row["purchase_date"]; $itemArr[$i]["quantity"] = $row["quantity"]; $itemArr[$i]["id"] = $row["id"]; $i++; } $giftObj = new lib_giftPoint($id); $point = $giftObj->point; $reduce = $giftObj->getReduction(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style> #main{ margin-top:20px; margin-left:50px; margin-right:50px; font-size:15px; } #mainform{ height:500px;
// check that txn_id has not been previously processed // check that receiver_email is your Primary PayPal email // check that payment_amount/payment_currency are correct // process payment if ($payment_status == 'Completed') { $query = "SELECT 'txn_id' FROM shop_ipn WHERE txn_id ='" . $txn_id . "'"; $result = mysql_query($query); if (mysql_num_rows($result) == 0) { if ($receiver_email == '*****@*****.**') { $totalcost = $obj->getCostTotal(); $shipcost = getShippingCost($obj->getItemTotal()); $taxcost = getTaxCost($totalcost); $reduce = 0; //default if ($obj2->isApplyDiscount($totalcost) == true) { $reduce = $obj2->getReduction() * -1; $taxcost = getTaxCost($totalcost - $obj2->getReduction()); } $finalcost = $totalcost + $shipcost + $taxcost + $reduce; if ($payment_amount < $finalcost * 1.005 + 0.1 and $payment_amount > $finalcost * 0.995 - 0.1 and $payment_currency == 'USD') { //reset gift point if it has been used: if ($obj2->isApplyDiscount($totalcost) == true) { $obj2->resetPoints(); } update_shopipn($id, $txn_id); update_store_status($id); delete_cart($id); $query = "SELECT expired_date FROM membership_ipn WHERE user_id = '{$id}'"; $result = mysql_query($query); if (mysql_num_rows($result) != 0) { $row = mysql_fetch_assoc($result);