37332-vm/update_event_status.php
Flatlogic Bot 298521e30e bb
2026-01-09 01:55:06 +00:00

32 lines
853 B
PHP

<?php
session_start();
if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'admin') {
header('Location: login.php');
exit();
}
if (isset($_GET['id']) && isset($_GET['status'])) {
require_once 'db/config.php';
$event_id = $_GET['id'];
$status = $_GET['status'];
if ($status === 'accepted' || $status === 'rejected') {
try {
$conn = db();
$stmt = $conn->prepare("UPDATE events SET status = :status WHERE id = :id");
$stmt->bindParam(':status', $status);
$stmt->bindParam(':id', $event_id, PDO::PARAM_INT);
$stmt->execute();
} catch (PDOException $e) {
// Handle database error
header('Location: admin_dashboard.php?error=db_error');
exit();
}
}
}
header('Location: admin_dashboard.php');
exit();