Hackfut Security File Manager
Current Path:
/home/u126195517/domains/foodstamping.in/public_html/admin
home
/
u126195517
/
domains
/
foodstamping.in
/
public_html
/
admin
/
📁
..
📁
assets
📄
categories.php
(15.94 KB)
📄
get-product.php
(604 B)
📄
index.php
(7.83 KB)
📄
login.php
(4.52 KB)
📄
logout.php
(557 B)
📄
orders.php
(10.34 KB)
📄
product-action.php
(2.63 KB)
📄
product-images.php
(14.15 KB)
📄
product-save.php
(6.86 KB)
📄
product-specifications.php
(11.11 KB)
📄
products.php
(48.18 KB)
📄
reviews.php
(12.46 KB)
📄
specifications.php
(14.72 KB)
Editing: orders.php
<?php // admin/orders.php session_start(); require_once '../config/database.php'; if (!isset($_SESSION['admin_id'])) { header("Location: login.php"); exit(); } $database = new Database(); $db = $database->getConnection(); // Handle order status update if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['action']) && $_POST['action'] == 'update_status') { $order_id = $_POST['order_id']; $status = $_POST['status']; $query = "UPDATE orders SET status = :status WHERE id = :id"; $stmt = $db->prepare($query); $stmt->bindParam(':status', $status); $stmt->bindParam(':id', $order_id); if ($stmt->execute()) { $_SESSION['message'] = "Order #{$order_id} status updated to '{$status}'."; $_SESSION['message_type'] = "success"; } else { $_SESSION['message'] = "Failed to update order status."; $_SESSION['message_type'] = "danger"; } header("Location: orders.php"); exit(); } // Fetch all orders $query = "SELECT * FROM orders ORDER BY created_at DESC"; $stmt = $db->prepare($query); $stmt->execute(); $orders = $stmt->fetchAll(PDO::FETCH_ASSOC); $order_statuses = ['pending', 'processing', 'shipped', 'delivered', 'cancelled']; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Manage Orders - Admin Panel</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/dataTables.bootstrap5.min.css"> <style> .sidebar { min-height: 100vh; background: #343a40; } .sidebar .nav-link { color: #fff; padding: 15px 20px; } .sidebar .nav-link:hover { background: #495057; } .sidebar .nav-link.active { background: #007bff; } .stat-card { border-radius: 10px; padding: 15px; margin-bottom: 20px; color: white; } .product-thumb { width: 50px; height: 50px; object-fit: cover; border-radius: 5px; cursor: pointer; } .badge-stock { font-size: 11px; } .action-buttons .btn { padding: 5px 10px; margin: 0 2px; } .filter-section { background: #f8f9fa; padding: 15px; border-radius: 10px; margin-bottom: 20px; } .bulk-actions { display: none; padding: 10px; background: #e9ecef; border-radius: 5px; margin-bottom: 10px; } .featured-star { color: gold; cursor: pointer; } .switch { position: relative; display: inline-block; width: 50px; height: 24px; } .switch input { opacity: 0; width: 0; height: 0; } .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 24px; } .slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; } input:checked + .slider { background-color: #2196F3; } input:checked + .slider:before { transform: translateX(26px); } </style> </head> <body> <div class="container-fluid"> <div class="row"> <!-- Sidebar --> <nav class="col-md-2 d-md-block sidebar bg-dark"> <div class="position-sticky"> <h4 class="text-white p-3">Admin Panel</h4> <ul class="nav flex-column"> <li class="nav-item"><a class="nav-link" href="index.php"><i class="fas fa-tachometer-alt"></i> Dashboard</a></li> <li class="nav-item"><a class="nav-link" href="products.php"><i class="fas fa-box"></i> Products</a></li> <li class="nav-item"><a class="nav-link" href="categories.php"><i class="fas fa-tags"></i> Categories</a></li> <li class="nav-item"><a class="nav-link active" href="orders.php"><i class="fas fa-shopping-cart"></i> Orders</a></li> <li class="nav-item"><a class="nav-link" href="reviews.php"><i class="fas fa-star"></i> Reviews</a></li> <li class="nav-item"><a class="nav-link" href="specifications.php"><i class="fas fa-list"></i> Specifications</a></li> <li class="nav-item"><a class="nav-link" href="logout.php"><i class="fas fa-sign-out-alt"></i> Logout</a></li> </ul> </div> </nav> <!-- Main Content --> <main class="col-md-10 ms-sm-auto px-md-4"> <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom"> <h1 class="h2">Manage Orders</h1> </div> <?php if (isset($_SESSION['message'])): ?> <div class="alert alert-<?php echo $_SESSION['message_type']; ?> alert-dismissible fade show" role="alert"> <?php echo $_SESSION['message']; unset($_SESSION['message'], $_SESSION['message_type']); ?> <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> </div> <?php endif; ?> <div class="card"> <div class="card-body"> <table id="ordersTable" class="table table-hover"> <thead> <tr> <th>Order #</th> <th>Customer</th> <th>Date</th> <th>Total</th> <th>Payment</th> <th>Status</th> <th>Actions</th> </tr> </thead> <tbody> <?php foreach ($orders as $order): ?> <tr> <td>#<?php echo $order['order_number']; ?></td> <td> <strong><?php echo htmlspecialchars($order['customer_name']); ?></strong><br> <small class="text-muted"><?php echo htmlspecialchars($order['customer_email']); ?></small><br> <small><?php echo htmlspecialchars($order['customer_phone']); ?></small> </td> <td><?php echo date('M d, Y h:i A', strtotime($order['created_at'])); ?></td> <td><strong>Rs. <?php echo number_format($order['total_amount'], 2); ?></strong></td> <td> <?php if ($order['payment_status'] == 'paid'): ?> <span class="badge bg-success">Paid</span> <?php elseif ($order['payment_status'] == 'failed'): ?> <span class="badge bg-danger">Failed</span> <?php else: ?> <span class="badge bg-warning text-dark">Pending</span> <?php endif; ?> <br><small class="text-muted"><?php echo htmlspecialchars($order['payment_method']); ?></small> </td> <td> <form action="orders.php" method="POST" class="d-flex"> <input type="hidden" name="action" value="update_status"> <input type="hidden" name="order_id" value="<?php echo $order['id']; ?>"> <select name="status" class="form-select form-select-sm" onchange="this.form.submit()"> <?php foreach ($order_statuses as $status): ?> <option value="<?php echo $status; ?>" <?php echo $order['status'] == $status ? 'selected' : ''; ?>> <?php echo ucfirst($status); ?> </option> <?php endforeach; ?> </select> </form> </td> <td> <a href="order-details.php?id=<?php echo $order['id']; ?>" class="btn btn-sm btn-info" title="View Details"> <i class="fas fa-eye"></i> </a> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> </main> </div> </div> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> <script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.11.5/js/dataTables.bootstrap5.min.js"></script> <script> $(document).ready(function() { $('#ordersTable').DataTable({ "order": [[2, "desc"]] }); }); </script> </body> </html>
Upload File
Create Folder