Php 页码为';登录后无法正确重定向。页面为’;不能正确地重定向
我已经在我的网站上创建了一个登录页面。这会将用户重定向到index.php并隐藏登录和注册页面。但这就是我得到的 “页面未正确重定向 Firefox检测到服务器正在以一种永远无法完成的方式重定向对此地址的请求Php 页码为';登录后无法正确重定向。页面为’;不能正确地重定向,php,authentication,session,cookies,indexing,Php,Authentication,Session,Cookies,Indexing,我已经在我的网站上创建了一个登录页面。这会将用户重定向到index.php并隐藏登录和注册页面。但这就是我得到的 “页面未正确重定向 Firefox检测到服务器正在以一种永远无法完成的方式重定向对此地址的请求 This problem can sometimes be caused by disabling or refusing to accept cookies." 不过,我还没有在页面上设置任何cookies 登录脚本如下所示: <?php if(isset($_POST['log
This problem can sometimes be caused by disabling or refusing to accept cookies."
不过,我还没有在页面上设置任何cookies
登录脚本如下所示:
<?php
if(isset($_POST['login-submit'])){
include 'dbh.inc.php';
$mailuid = $_POST['mailuid'];
$password = $_POST['login-password'];
if(empty($mailuid)){
header("Location: ../login.php?error=emptymailuid");
exit();
}
if(empty($password)){
header("Location: ../login.php?error=pwdempty");
exit();
}
$sql = "SELECT * FROM users WHERE usersEmail=? OR usersUsername=?";
$stmt = mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt,$sql)){
header("Location: ../login.php?error=sqlError");
exit();
}else{
mysqli_stmt_bind_param($stmt,"ss",$mailuid,$mailuid);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$resultCheck = mysqli_num_rows($result);
if($resultCheck > 0){
if($row = mysqli_fetch_assoc($result)){
$isActive = $row['usersActive'];
if($isActive == "Yes"){
$passwordCheck = password_verify($password,$row['usersPassword']);
if($passwordCheck == false){
header("Location: ../login.php?error=wrongpwd");
exit();
}else if($passwordCheck == true){
session_start();
$_SESSION['id'] = $row['usersID'];
$_SESSION['userId'] = $row['usersUsername'];
$_SESSION['email'] = $row['usersEmail'];
header("Location: ../index.php");
exit();
}
}else{
header("Location: ../login.php?error=notActive");
}
}
}else{
header("Location: ../login.php?error=noUser");
exit();
}
}
}else{
header("Location: ../login.php");
exit();
}
我假设您向我们展示的脚本是login.php
?当您第一次登录时会发生什么?POST['login-submit']
未设置,因此它会重定向回login.php
POST['login-submit']
未设置,因此。。。