Redirect localhost/dashboard

2.7k views Asked by At

I have a problem with my personal site (using xampp);, any time I perform a log out when an imaginary user is alrealy logged in, I am redirected to the localhost/dashboard. Could you kindly say me how to solve?

Here is my 'logout' code:

<?php   /** --- logout.php --- **/
    require_once 'createSession.php';
    require_once 'https.php';

    if(!isset($loggedIn) || (!$loggedIn)) {
        $result = "<h2>You are not logged in!</h2>";
        if(isset($TimeoutExpired) && ($TimeoutExpired))
            $result = $result."<p>Timeout expired! You have not interacted with our server for too much time!</p>";
    }
    else {
        destroySession();
        echo "<h2>You have been successfully logged out.</h2>";
        $goodbye = true;
    }

    $loggedIn = false;
    header("Location: index.php");
?>

Where 'index.php' is my main page and it is in the same folder of this file Thank you!

0

There are 0 answers