<?php
session_start();

// Unset all session variables
$_SESSION = [];

// Destroy the session
session_destroy();

// Delete the cookie by setting its expiration time in the past
if (isset($_COOKIE['userid'])) {
    setcookie("userid", "", time() - 3600, "/"); // Set cookie expiration time in the past
}

// Redirect to the login page
header("Location: ../login.php");
exit();
?>
