One Hat Cyber Team
Your IP :
216.73.216.186
Server IP :
88.222.243.1
Server :
Linux in-mum-web1837.main-hosting.eu 5.14.0-503.34.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Mar 27 06:00:50 EDT 2025 x86_64
Server Software :
LiteSpeed
PHP Version :
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
u322583024
/
domains
/
awaha.in
/
public_html
/
View File Name :
order_details.php
<?php session_name('vaishnavi_awaha'); session_start(); require_once 'admin/connection.inc.php'; // Database connection file ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); // Ensure the user is logged in if (!isset($_SESSION['user_id'])) { header("Location: login.php?message=Please log in to view order details."); exit(); } // Get the order_id from the query string $order_id = trim($_GET['order_id'] ?? ''); // Validate order_id if (!$order_id) { echo "Order ID is missing."; exit(); } // Debugging: Check the logged-in user's session ID and the provided order ID echo "<pre>"; var_dump("Session User ID:", $_SESSION['user_id'], "Order ID:", $order_id); // Fetch order details $query = "SELECT o.*, u.name AS user_name, u.email AS user_email FROM orders o JOIN users u ON o.user_id = u.id WHERE o.order_id = ? AND o.user_id = ?"; echo "Executing query: " . $query; // Debugging: Output query $stmt = $conn->prepare($query); $stmt->bind_param("si", $order_id, $_SESSION['user_id']); $stmt->execute(); $result = $stmt->get_result(); // If no results, display error if ($result->num_rows === 0) { echo "Order not found or you do not have permission to view it."; exit(); } // Fetch the order details $order = $result->fetch_assoc(); // Fetch order items $item_query = "SELECT oi.product_name, oi.quantity, oi.price, (oi.quantity * oi.price) AS total FROM order_items oi WHERE oi.order_id = ?"; $stmt = $conn->prepare($item_query); $stmt->bind_param("s", $order_id); $stmt->execute(); $order_items = $stmt->get_result(); // Debugging: Check order details and items echo "Order Details:"; var_dump($order); echo "Order Items:"; var_dump($order_items->fetch_all()); ?> <!DOCTYPE html> <html lang="en"> <head> <!--====== Required meta tags ======--> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!--====== Title ======--> <title>Order Details | Awaha</title> <!--====== Stylesheets ======--> <link rel="stylesheet" href="assets/vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" href="assets/css/style.css"> <style> .order-details-container { margin-top: 30px; } .order-summary { background-color: #f7f7f7; padding: 20px; border-radius: 10px; } .order-items-table { margin-top: 20px; } .order-items-table th, .order-items-table td { text-align: center; } </style> </head> <body> <!--====== Start Header ======--> <?php include 'header.php'; ?> <!--====== End Header ======--> <main class="container order-details-container"> <h1 class="text-center">Order Details</h1> <div class="row justify-content-center"> <div class="col-md-8"> <div class="order-summary"> <h3>Order Summary</h3> <p><strong>Order ID:</strong> <?php echo htmlspecialchars($order['order_id']); ?></p> <p><strong>Order Date:</strong> <?php echo htmlspecialchars($order['order_date']); ?></p> <p><strong>Total Amount:</strong> ₹<?php echo number_format($order['total_amount'], 2); ?></p> <p><strong>Payment Method:</strong> <?php echo htmlspecialchars($order['payment_method']); ?></p> <p><strong>Order Status:</strong> <?php echo htmlspecialchars($order['order_status']); ?></p> </div> <div class="order-items-table"> <h4>Ordered Items</h4> <table class="table table-bordered"> <thead> <tr> <th>Product Name</th> <th>Quantity</th> <th>Price (₹)</th> <th>Total (₹)</th> </tr> </thead> <tbody> <?php while ($item = $order_items->fetch_assoc()): ?> <tr> <td><?php echo htmlspecialchars($item['product_name']); ?></td> <td><?php echo htmlspecialchars($item['quantity']); ?></td> <td><?php echo number_format($item['price'], 2); ?></td> <td><?php echo number_format($item['total'], 2); ?></td> </tr> <?php endwhile; ?> </tbody> </table> </div> <div class="text-center mt-4"> <a href="orders.php" class="btn btn-primary">Back to Orders</a> </div> </div> </div> </main> <!--====== Start Footer ======--> <?php include 'footer.php'; ?> <!--====== End Footer ======--> <!--====== Scripts ======--> <script src="assets/vendor/jquery-3.7.1.min.js"></script> <script src="assets/vendor/bootstrap/js/bootstrap.min.js"></script> </body> </html>