<?php
require_once '../../includes/functions.php';
requireAdmin();
$id = intval($_GET['id'] ?? 0);
$guru = db_fetch("SELECT * FROM guru WHERE id = ?", [$id]);
if ($guru) {
    db_query("DELETE FROM users WHERE id = ?", [$guru['user_id']]);
    setFlash('success', "Guru {$guru['nama']} berhasil dihapus.");
} else {
    setFlash('danger', 'Data tidak ditemukan.');
}
header('Location: list.php'); exit;
