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';
?>