<?php
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

if (!isset($_SESSION['user'])) {
    header("Location: /presensi_v1/auth/login.php");
    exit;
}

if ($_SESSION['user']['role'] !== 'guru') {
    header("Location: /presensi_v1/preview.php");
    exit;
}
