为一些课程工作登录,有些原因,即使符合标准,它也永远不会出现在其他地方,我已经使用变量打印来证明这一点,我们将非常感谢任何帮助。
if($_SESSION['username'] == $row['UserID'] and $password == $row['password'] and $row['loginAttempts'] < 3)
{
//setting student session and redirecting
if ($row["type"] == "0")
{
echo "student login";
$_SESSION['student'] = 'true';
$resetLoginAttempts;
//header('Location: studenthome.php');
}
//setting staff session and redirecting
if ($row["type"] == "1")
{
echo "Staff login";
$_SESSION['staff'] = 'true';
$resetLoginAttempts;
//header('Location: staffhome.php');S
}
}
//correct username but wrong password not over max login attempts
elseif($_SESSION['username'] == $row['UserID'] and $password =! $row['password'] and $row['loginAttempts'] < 3)
{
echo "wrong pass";
$incrementLoginAttemts;
}
//correct username, incorrect or correct password but user has used their 3 login attempts
elseif($_SESSION['username'] == $row['UserID'] and $row['loginAttempts'] == 3)
{
echo "You've have been locked out, please contact the system admin";
}
elseif($_SESSION['username'] =! $row['UserID'] and $row['loginAttempts'] =! 3)
{
echo "wrong user name";
}
}
答案 0 :(得分:1)
答案 1 :(得分:0)
如果条件如下,则需要添加括号:
if(($_SESSION['username'] == $row['UserID']) and ($password == $row['password']) and ($row['loginAttempts'] < 3))
希望这将是你的幸运