Файловый менеджер - Редактировать - /home/emeraadmin/public_html/pages/emeraadmin/delete_schedule.php
Назад
<?php session_start(); // Ensure sessions are started require_once '../../Classes/Database.php'; require_once '../../Service/ScheduleService.php'; require_once '../../Service/UserService.php'; // Include the UserService require_once '../../Classes/System.php'; $System = new System(); $scheduleService = new ScheduleService(); $userService = new UserService(); // Instantiate the UserService // Check if the request is POST and the password is provided if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['password'])) { // Use the UserService to verify the user's password if ($userService->verifyUserPassword($_SESSION['user_email'], $_POST['password'])) { // Proceed with deletion if (isset($_POST['scheduleId']) && !empty($_POST['scheduleId'])) { $scheduleId = $System->decryptData($_POST['scheduleId']); if (!$scheduleId) { echo "Invalid Schedule ID"; exit; } // Pass the scheduleId and userId (assuming it's stored in session as user_id) $userId = $_SESSION['user_id']; // Fetch the userId from the session // Call the method with both arguments $deleteResult = $scheduleService->deleteScheduleWithTasksByAdmin($scheduleId, $userId); if ($deleteResult === true) { echo "success"; } else { echo $deleteResult; // Echo error message or permission denied } } else { echo "Schedule ID is missing"; } } else { echo "Invalid password"; exit; } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка