Q:

Login using session error: net::ERR_TOO_MANY_REDIRECTS

I'm trying to use the session system to create a login however, I keep getting a redirect error. Once I enter the correct username (Admin) and password (murphy1) the page refreshes and I get this error in the console:

net::ERR_TOO_MANY_REDIRECTS

Now if I simply refresh the page it logs in or if I reenter the username and password a second time a post the results again it logs in. Could someone please refer me to where I'm going wrong here, I would really appriate it?
<?php
ob_clean();
session_start();

if (isset($_SESSION['loggedin']) || $_SESSION['loggedin'] == true){
    header("Location: SeniorManagersSiteTour.php");
}

if ($_SERVER['REQUEST_METHOD'] == 'POST'){
    $Username = $_POST['username'];
    $Password = $_POST['password'];

    if ($Username == 'Admin'){
        if($Password == 'murphy1'){
            $_SESSION["loggedin"] = true;
            $Error = "00";
        }
        else{
            $Error = "01";
        }
    }
    else{
        $Error = "02";
    }
}
?>

A:

Your if statement is wrong.
It will work if you change it to:
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true)
Reason: If you pass a session variable to isset function without other check it can assume it's true.

