<?php
// Initialize the session
require_once "config.php";
// session_start();
if (!isset($_SESSION)) {
    session_start();
}

$username = $_SESSION["username"];
$sqlupdatelogstatus = "UPDATE users SET logged_in_out='Logged_Out' WHERE username='$username'";
$stmt = $mysqli->prepare($sqlupdatelogstatus);
$stmt->execute();
// Unset all of the session variables
$_SESSION = array();

// Destroy the session.
session_destroy();

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