36247-vm/auth.php
Flatlogic Bot f0947adeb2 version1
2025-11-25 08:03:40 +00:00

17 lines
359 B
PHP

<?php
session_start();
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit;
}
// Optional: Role-based access control
function require_role($role) {
if ($_SESSION['role'] !== $role) {
// Redirect to a generic dashboard or an error page
header("Location: login.php?error=unauthorized");
exit;
}
}
?>