Files
transfer.tapee.ac.th/students/delete.php
T
pongpon pitisuk 72701ad58c Initial import
2026-06-25 16:49:13 +07:00

27 lines
492 B
PHP

<?php
require_once __DIR__ . '/../includes/functions.php';
requireLogin();
if (isStudent()) {
header('Location: ' . BASE_URL . '/index.php');
exit;
}
$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;