<?php require_once __DIR__.'/../includes/auth.php'; require_login(['admin']); require __DIR__.'/../includes/header.php';
$stats=[]; foreach(['users','courses','modules','certificates'] as $t){$stats[$t]=db()->query("SELECT COUNT(*) c FROM $t")->fetch()['c'];}
?>
<div class="card"><h1>Admin Dashboard</h1><div class="grid">
<?php foreach($stats as $k=>$v): ?><div class="card"><h2><?= ucfirst($k) ?></h2><p class="cert-title"><?= $v ?></p></div><?php endforeach; ?></div>
<a class="btn" href="users.php">Manage Users</a> <a class="btn dark" href="courses.php">Courses</a></div>
<?php require __DIR__.'/../includes/footer.php'; ?>
