Please login to view your cart

"; return; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['delete_single'])) { $order_id = intval($_POST['delete_single']); if ($order_id > 0) { // First, check if the status is 'renew' $stmt = $db->prepare("SELECT status FROM ogp_billing_orders WHERE order_id = ? AND user_id = ?"); $stmt->bind_param("ii", $order_id, $user_id); $stmt->execute(); $stmt->bind_result($status); if ($stmt->fetch() && strtolower($status) === 'renew') { $stmt->close(); // Set status to 'expired' if currently 'renew' $update = $db->prepare("UPDATE ogp_billing_orders SET status = 'expired' WHERE order_id = ? AND user_id = ?"); $update->bind_param("ii", $order_id, $user_id); $update->execute(); $update->close(); } else { $stmt->close(); // Otherwise, delete the order $delete = $db->prepare("DELETE FROM ogp_billing_orders WHERE order_id = ? AND user_id = ?"); $delete->bind_param("ii", $order_id, $user_id); $delete->execute(); $delete->close(); } } } if ($db){ $carts = $db->query("SELECT * FROM ogp_billing_orders AS cart WHERE (status = 'in-cart' OR status = 'renew') AND user_id = " . $user_id . " ORDER BY order_id ASC"); } ?>

Your Cart

num_rows > 0) { while ($row = $carts->fetch_assoc()) { ?>
Server ID Game Name Location Max Players Price per Player Months Total
$ $
Cart Total: $
No items in your cart.
'srv123','amount'=>9.99], ['serverID'=>'srv999','amount'=>14.50]] // --- Sanity + normalization --- if (!isset($grandTotal) || !is_numeric($grandTotal)) { $grandTotal = 0.00; } if (!isset($invoice) || !is_array($invoice)) { $invoice = []; } $currency = 'USD'; $amount = number_format((float)$grandTotal, 2, '.', ''); $lineItems = []; // Build PayPal-friendly items array (name, unit_amount, quantity, sku) foreach ($invoice as $i) { $sid = isset($i['serverID']) ? (string)$i['serverID'] : 'unknown'; $amt = isset($i['amount']) && is_numeric($i['amount']) ? number_format((float)$i['amount'], 2, '.', '') : '0.00'; $lineItems[] = [ 'name' => "Server $sid", 'quantity' => '1', 'unit_amount' => ['currency_code' => $currency, 'value' => $amt], 'sku' => $sid ]; } // Single overall invoice id for the order $invoiceId = 'INV-' . date('Ymd-His') . '-' . bin2hex(random_bytes(3)); // A short custom reference derived from your line items (<= 127 chars for PayPal) $customHash = substr(strtoupper(sha1(json_encode($invoice))), 0, 16); $customId = "INVREF-$customHash"; // Text on the PayPal side $description = 'Game server order (' . count($lineItems) . ' item' . (count($lineItems)===1?'': 's') . ')'; // URLs $siteBase = 'https://panel.iaregamer.com'; $returnUrl = $siteBase . '/paypal/return.php?invoice=' . urlencode($invoiceId); $cancelUrl = $siteBase . '/paypal/return.php?invoice=' . urlencode($invoiceId) . '&cancel=1'; // API base (relative) $apiBase = '/paypal/api'; ?>