36952-vm/delete_request.php
Flatlogic Bot 76d7d99142 PMS 1
2025-12-15 01:31:18 +00:00

27 lines
704 B
PHP

<?php
require_once 'session.php';
check_admin();
require_once 'db/config.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$id = $_POST['id'] ?? null;
if ($id) {
try {
$db = db();
$stmt = $db->prepare("DELETE FROM maintenance_requests WHERE id = ?");
$stmt->execute([$id]);
header("Location: index.php?page=maintenance&success=Request deleted");
exit;
} catch (PDOException $e) {
header("Location: index.php?page=maintenance&error=Error deleting request");
exit;
}
}
} else {
// Redirect if not a POST request
header("Location: index.php?page=maintenance");
exit;
}
?>