<?php 
    // Initialize the session.
    // If you are using session_name("something"), don't forget it now!
    session_start();

    // Unset all of the session variables.
    $_SESSION = array();

    // If it's desired to kill the session, also delete the session cookie.
    // Note: This will destroy the session, and not just the session data!
    if (ini_get("session.use_cookies")) {
        $params = session_get_cookie_params();
        setcookie(session_name(), '', time() - 42000,
            $params["path"], $params["domain"],
            $params["secure"], $params["httponly"]
        );
    }

    // Add includes to PHP files that I will need to access
    include_once dirname(__FILE__) . '/../php_only_scripts/database.php';

    // Create and Setup the database
    $db = new Database();
    $db->setupTmsDB();
    
    // Attempt to log in with this user
    $db->logoutSession(session_id());
            
    // Finally, destroy the session.
    session_destroy();

    // redirect to the login page
    echo ('<script>window.location = "../";</script>');
?>