说到我的最后一个代码,它不会将我的登录页面指向 index.php 吗?你认为问题出在header()
功能上吗?
if (empty($_POST)===false){
$username = $_POST['username'];
$password = $_POST['password'];
if(empty($username)=== true || empty($password)=== true){
$errors[] = 'You need to enter a user name and password';
}else if(user_exists($username)===false){
$errors[] = 'we can\'t find that username. Have you registed?';
}else if(user_active($username)===false){
$errors[] = 'You have\'t activated your account ! please check your email and active it';
}else{
$login = login($username,$password);
if($login === false){
$errors[] = "That username/password combination is not correct";
}else{
$_SESSION['id'] = $login;
header('Location:index.php');
exit();
}
}
print_r($errors);
}
?>