工作在登录某些课程的工作和某些原因,它永远不会最近的其他如果即使条件满足,我已经证明这使用变量的打印任何帮助将是多赞赏。如果其他语句不工作在php
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";
}
}
有只有三岁的'elseif's这里。哪一个不行? –
这些应该是函数调用? '$ resetLoginAttempts;'和'$ incrementLoginAttemts;' – JimL