Redirect stopped working
<p>I created a basic login script in php. on my lampp localhost the redirects work fine. when I load the template to another server the redirects dont work anymore. Can anyone tell me why this is and how to fix it, it would be greatly appreciated. Thanks</p>

<p>Here is the script for admin.php which holds a login form. if <code>$_SESSION['logged_in']</code> is set then the user should be redirected to the backend.php page every time. But on the server it keeps showing the admin.php page every time. but again when I am on my lampp localhost it works fine.</p>

<pre><code>$users = new Users;

if (isset($_SESSION['logged_in']) === true) {
    header('Location: backend.php');
} else {
    if (empty($_POST) === false) {
        $username = $_POST['username'];
        $password = $_POST['password'];

        if (empty($username) === true || empty($password) === true) {
            $errors[] = 'All fields are required!';
        } else {
            $login = $users-&gt;login($username, $password);

            if ($login == 0) {
                $errors[] = 'Username or password incorrect!';
            } else {
                $_SESSION['logged_in'] = true;
                header('Location: backend.php');
                exit();
            }
        }
    }
}
</code></pre>
