<?php
// Start the session
session_start();
$role=$_SESSION["role"];   $url=$_SESSION["last_url"];
// Unset all of the session variables
$_SESSION = [];

// If session was propagated with a cookie, delete the session cookie
if (ini_get("session.use_cookies")) {
    $params = session_get_cookie_params();
    setcookie(
        session_name(), 
        '', 
        time() - 42000,
        $params["path"], 
        $params["domain"],
        $params["secure"], 
        $params["httponly"]
    );
}

// Finally, destroy the session
session_destroy();

if( isset($role) && $role=="Admin" )  {header("Location: $url"); }
 if(  isset($role) &&  $role=="User")  { header("Location: $url"); }
 if(  isset($role) &&  $role=="Manager")  { header("Location: $url"); } 



exit;
?>
