📁
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_update_status.php
<?php require_once 'config/auth.php'; require_once 'config/db.php'; error_reporting(E_ALL); ini_set('display_errors', 1); // Redirect page destination on completion/failure $redirectPage = "existing-server-status.php"; if ($_SERVER['REQUEST_METHOD'] !== 'POST') { header("Location: " . $redirectPage); exit(); } // 1. Verify User Session if (!isset($_SESSION['user'])) { header("Location: index.php"); exit(); } $user = $_SESSION['user']; $user_id = (int)($user['id'] ?? 0); $user_username = trim($user['username'] ?? 'System'); $user_role = strtolower(trim($user['role'] ?? 'user')); $request_db_id = (int)($_POST['request_db_id'] ?? 0); $action_type = trim($_POST['action_type'] ?? ''); $status_note = trim($_POST['status_note'] ?? $_POST['notes'] ?? ''); $new_status = trim($_POST['new_status'] ?? ''); if ($request_db_id <= 0) { $_SESSION['error'] = "Invalid request ID."; header("Location: " . $redirectPage); exit(); } // 2. Fetch Current Request Details from existing_server_requests $stmt = $conn->prepare("SELECT * FROM existing_server_requests WHERE id = ? LIMIT 1"); $stmt->bind_param("i", $request_db_id); $stmt->execute(); $currentRequest = $stmt->get_result()->fetch_assoc(); if (!$currentRequest) { $_SESSION['error'] = "Existing server request not found."; header("Location: " . $redirectPage); exit(); } $old_status = $currentRequest['status']; // Helper function to check column presence in existing_server_requests table function hasColumn($conn, $colName) { $res = $conn->query("SHOW COLUMNS FROM existing_server_requests LIKE '$colName'"); return $res && $res->num_rows > 0; } // 3. Process Role-Based Updates if ($action_type === 'management' && in_array($user_role, ['manager', 'management', 'admin'])) { // Management/Manager Actions: Under Review, Approved, Rejected if (!in_array($new_status, ['Under Review', 'Approved', 'Rejected'])) { $_SESSION['error'] = "Invalid status selected for management action."; header("Location: " . $redirectPage); exit(); } $updateStmt = $conn->prepare("UPDATE existing_server_requests SET status = ? WHERE id = ?"); $updateStmt->bind_param("si", $new_status, $request_db_id); $updateStmt->execute(); } elseif ($action_type === 'sales' && (in_array($user_role, ['sales', 'sales team']) || $user_role === 'admin')) { if ($new_status === 'Validation') { // Step 1: Sales Validation $updateStmt = $conn->prepare("UPDATE existing_server_requests SET status = 'Validation' WHERE id = ?"); $updateStmt->bind_param("i", $request_db_id); $updateStmt->execute(); } elseif ($new_status === 'Completed') { // Step 2: Completion Handover $updateStmt = $conn->prepare("UPDATE existing_server_requests SET status = 'Completed' WHERE id = ?"); $updateStmt->bind_param("i", $request_db_id); $updateStmt->execute(); } else { $_SESSION['error'] = "Invalid sales workflow status."; header("Location: " . $redirectPage); exit(); } } else { $_SESSION['error'] = "Unauthorized status action."; header("Location: " . $redirectPage); exit(); } // 4. Log Action strictly into Existing Timeline History (existing_request_history) $logCheck = $conn->query("SHOW TABLES LIKE 'existing_request_history'"); if ($logCheck && $logCheck->num_rows > 0) { $actorRoleFormatted = ucfirst($user_role) . " (" . $user_username . ")"; $logStmt = $conn->prepare("INSERT INTO existing_request_history (request_id, from_status, to_status, action_notes, actor_role) VALUES (?, ?, ?, ?, ?)"); $logStmt->bind_param("issss", $request_db_id, $old_status, $new_status, $status_note, $actorRoleFormatted); $logStmt->execute(); } $_SESSION['success'] = "Status successfully updated to <strong>" . htmlspecialchars($new_status) . "</strong>."; header("Location: " . $redirectPage); exit(); ?>
Save