0

I keep getting this error message when I try to 'login' to my php member system that I'm creating.

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\acrd\includes\header.php:24) in C:\xampp\htdocs\acrd\login.php on line 21

Here is line 21

header('Location: index.php');

Here is my code. Please help!

    <?php
    include 'core/init.php';
    include 'includes/overall/header.php';

    if (empty($_POST) === false) {
        $username = $_POST['username'];
        $password = $_POST['password'];

        if (empty($username) === true || empty($password) === true) {
            $errors[] = 'You need to enter a username and password.';
        } else if (user_exists($username) === false) {
            $errors[] = 'We cannot find that username. Have you registered?';
        } else if (user_active($username) === false) {
            $errors[] = 'You have not activated your account.';
        } else {
            $login = login($username, $password);
            if ($login === false) {
                $errors[] = 'That username/password combination is incorrect.';
            } else {
                $_SESSION['user_id'] = $login;
                header('Location: index.php');
                exit();
            }
    }
        print_r($errors);
    }
    include 'includes/overall/footer.php';
    ?>
2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by gorybmovie
0

I finally got it! Thank you. I had to put in <?php ob_start();?>
Maybe because I'm using Dreamweaver.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.