<?php
function authorize() {

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

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

    // 🚫 block ONLY guest
    if ($_SESSION['role'] === 'guest') {
        header("Location: guest_home.php");
        exit();
    }
}
?>