prepare("SELECT * FROM products WHERE id = ?"); $stmt->execute([$direct_id]); $direct_product = $stmt->fetch(); } $redirect_url = ''; // Handle POST request to create order if ($_SERVER['REQUEST_METHOD'] === 'POST') { $db = db(); $payment_method = $_POST['payment_method'] ?? 'USDT (TRC20)'; $cart_data = json_decode($_POST['cart_data'], true); if (!empty($cart_data)) { // Calculate total $total = 0; foreach ($cart_data as $item) { $total += $item['price'] * $item['qty']; } // Generate order number $order_no = 'HR' . date('YmdHis') . rand(100, 999); // Create order $stmt = $db->prepare("INSERT INTO orders (order_no, total_amount, payment_method, contact_info, status) VALUES (?, ?, ?, '', 'pending')"); $stmt->execute([$order_no, $total, $payment_method]); $order_id = $db->lastInsertId(); // Create order items foreach ($cart_data as $item) { $stmt = $db->prepare("INSERT INTO order_items (order_id, product_id, quantity, price_usdt) VALUES (?, ?, ?, ?)"); $stmt->execute([$order_id, $item['id'], $item['qty'], $item['price']]); } // Send Telegram notification if (function_exists('sendTelegramMessage')) { $msg = "🔔 *New Order Created*\n\n"; $msg .= "Order No: `{$order_no}`\n"; $msg .= "Total Amount: `{$total} USDT`\n"; $msg .= "Status: Pending Payment"; sendTelegramMessage($msg); } $redirect_url = "payment.php?order_no=" . $order_no; header("Location: " . $redirect_url); exit; } } ?>

确认订单信息

USDT (TRC20)
推荐使用,区块链自动确认
订单详情

应付总额 0.00 USDT