<?php
session_start();

if(isset($_SESSION['type']) && $_SESSION['type'] === 'Waiter') {
    // Unset common session variables
    unset($_SESSION['transaction']);
    unset($_SESSION['cartz']);
    unset($_SESSION['cart']);
    unset($_SESSION['total']);
    unset($_SESSION['order']);

    // Redirect to the appropriate page after logout
    header('location:../logout.php');
} else {
    // For other user types or if the 'type' session variable is not set
    // Unset the common session variables
    unset($_SESSION['transaction']);
    unset($_SESSION['cartz']);
    unset($_SESSION['cart']);
    unset($_SESSION['total']);
    unset($_SESSION['order']);
    
    // Redirect to the appropriate page after logout
    header('location:../menu.php');
}

?>
