|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: |
// Check the transaction type
function txnIPN($data)
{
if ($_POST['txn_type'] == "cart") {
return 1;
} else if ($_POST['txn_type'] == "send_money") {
return 2;
}
}
// Process the shopping cart
function processShoppingCart($data)
{
// Get items
for ($i=1; $i <= $_POST['num_cart_items'] ; $i++)
{
// Make the inputs safe from SQL injection hacking
$id = mysql_real_escape_string($data['item_number{$i}']);
$amount = mysql_real_escape_string($data['mc_gross_{$i}']);
// Query for the data
$query = "SELECT * FROM projects WHERE `id_prj` = $id";
$result1 = insertQuery($query);
// Retrieve the query data and compute
$row = mysql_fetch_array($result1);
$paid = $row['paid_prj'] + $amount;
$due = $row['due_prj'] - $amount;
$notes = $row['notes_prj'] . "A payment of $" . number_format($amount, 2) . " was made on " . date('l, F j, Y') . " at " . date('g:i A T') . ". ";
// Update the database
$query{$i} = "UPDATE projects SET `paid_prj` = '$paid', `due_prj` = '$due', `notes_prj` = '$notes' WHERE `id_prj` = $id LIMIT 1";
insertQuery($query{$i});
}
// Make the inputs safe from SQL injection hacking
$referenceid = session_id();
$visitorid = mysql_real_escape_string($data['custom']);
$shipping = mysql_real_escape_string($data['shipping']);
$tax = mysql_real_escape_string($data['tax']);
$total = mysql_real_escape_string($data['payment_gross']);
$date = date('Y-m-d H:i:s');
$shipaddress = mysql_real_escape_string($data['address_street']);
$shipcity = mysql_real_escape_string($data['address_city']);
$shipstateid = mysql_real_escape_string($data['address_state']);
$shipzip = mysql_real_escape_string($data['address_zip']);
$shipcountryid = mysql_real_escape_string($data['address_country_code']);
switch ($data['payment_status']) { case "Completed": $status = "1"; break; case "Pending": $status = "2"; break; case "Reversed": $status = "3"; break; case "Refunded": $status = "4"; break; case "Voided": $status = "5"; break; default: $status = ""; }
// Update the database
$queryx = "INSERT INTO orders (OrderReferenceID, OrderVisitorID, OrderShipping, OrderTax, OrderTotal, OrderDate, OrderShipAddress1, OrderShipCity, OrderShipStateID, OrderShipZip, OrderShipCountryID, OrderStatus) VALUES ('$referenceid', '$visitorid', '$shipping', '$tax', '$total', '$date', '$shipaddress', '$shipcity', '$shipstateid', $shipzip, '$shipcountryid', '$status')";
insertQuery($queryx);
// Get items
for ($i=1; $i <= $_POST['num_cart_items'] ; $i++)
{
// Make the inputs safe from SQL injection hacking (for the order detail table)
$detailorderid = mysql_insert_id();
$detailitemid = mysql_real_escape_string($data['item_number{$i}']);
$detailitemname = mysql_real_escape_string($data['item_name{$i}']);
$detailitemdesc = "Payment for " . mysql_real_escape_string($data['item_name{$i}']) . ". ";
$detailquantity = mysql_real_escape_string($data['quantity{$i}']);
$detailprice = mysql_real_escape_string($data['mc_gross_{$i}']);
// Update the database (for the order detail table)
$query{$i} = "INSERT INTO orderdetails (DetailOrderID, DetailItemID, DetailItemName, DetailItemDesc, DetailQuantity, DetailPrice) VALUES ('$detailorderid', '$detailitemid', '$detailitemname', '$detailitemdesc', '$detailquantity', '$detailprice')";
insertQuery($query{$i});
}
}
// Step 0.5. Check the transaction type
$result = txnIPN($_POST);
if ($result == 1)
{
// Process cart
processShoppingCart($_POST);
exit();
}
|
Advertisement
| Hall of Fame |