<?php
require_once __DIR__ . '/../includes/functions.php';
requireLogin();
$id = intval($_GET['id'] ?? 0);
requireStudentAccess($id);
$student = getStudent($id);
if (!$student) {
    header('Location: list.php');
    exit;
}

try {
    $stmt = getDB()->prepare("DELETE FROM students WHERE id = ?");
    $stmt->execute([$id]);
} catch (PDOException $e) {
    // ignore
}

header('Location: list.php');
exit;
