谈到我的代码的最后一个
它不会将我的登录页面指向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);
}
?>
答案 0 :(得分:0)
如果您想检查header()
功能是否有效。首先删除所有if-else conditions
和header()
函数肯定会有效。然后逐一给出if-else condition
并echo or print
一些值用于检查响应。