28 lines
749 B
PHP
28 lines
749 B
PHP
<?php
|
|
session_start();
|
|
require_once 'db/config.php';
|
|
require_once 'includes/admin_auth.php';
|
|
|
|
if (!admin_is_logged_in()) {
|
|
header('Location: login.php');
|
|
exit;
|
|
}
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['id']) && is_numeric($_POST['id'])) {
|
|
$id = (int) $_POST['id'];
|
|
$pdo = db();
|
|
$stmt = $pdo->prepare('UPDATE attendees SET deleted_at = NOW() WHERE id = ? AND deleted_at IS NULL');
|
|
$stmt->execute([$id]);
|
|
|
|
if ($stmt->rowCount() > 0) {
|
|
admin_set_flash("Attendee #{$id} has been archived successfully.");
|
|
} else {
|
|
admin_set_flash("No active attendee found for ID #{$id}.");
|
|
}
|
|
} else {
|
|
admin_set_flash('Error: Invalid archive request.');
|
|
}
|
|
|
|
header('Location: admin.php');
|
|
exit;
|