⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.124
Server IP:
50.28.103.30
Server:
Linux host.jcukjv-lwsites.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
Server Software:
nginx/1.28.0
PHP Version:
8.3.12
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
www
/
wwwroot
/
sd.electronharmony.com
/
works
/
Edit File: add_ws.php
connect_error) { die("Connection failed: " . $conn->connect_error); } // Add employee and generate days with default status 'Off' function addEmployeeWithDays($conn, $employeeName) { // Insert the employee into the employees table $stmt = $conn->prepare("INSERT INTO employees (name) VALUES (?)"); $stmt->bind_param("s", $employeeName); $stmt->execute(); $employeeID = $conn->insert_id; // Get the newly created employee's ID // Get the total number of days in the current month $lastDay = date("t"); // Insert days with default status 'Off' $stmt = $conn->prepare("INSERT INTO employee_days (employee_id, day_of_month, status) VALUES (?, ?, 'v')"); for ($day = 1; $day <= $lastDay; $day++) { $stmt->bind_param("ii", $employeeID, $day); $stmt->execute(); } $stmt->close(); } // Handle form submission if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['name'])) { $employeeName = htmlspecialchars($_POST['name']); // Sanitize user input addEmployeeWithDays($conn, $employeeName); echo '
Employee and daily records added successfully!
'; header("Location: ws.php"); } else { echo '
Invalid form submission.
'; } // Close connection $conn->close(); ?>
Simpan