<?php
require_once 'db.php';

if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

$isStaff = isset($_SESSION['staff_id']);
$isAdmin = isset($_SESSION['admin_id']);

session_unset();
session_destroy();

if ($isStaff) {
    header('Location: staff-login.php');
} elseif ($isAdmin) {
    header('Location: admin-login.php');
} else {
    header('Location: staff-login.php');
}
exit;