while ($stmt->fetch()) {
if ($teacherusername == $dbTeacherUsername && $teacherpassword == $dbTeacherPassword) {
if ($dbActive == 1) {
$loggedIn = true;
} else if ($dbActive == 0) {
$loggedIn = false;
echo "You Must Activate Your Account from Email to Login";
}
}
}
if ($loggedIn == false && $_POST) {
echo "The Username or Password that you Entered is not Valid. Try Entering it Again";
}
在上面的代码中,我在显示一条消息时遇到了问题,我似乎无法弄清楚我做错了什么。如果用户输入错误的密码或用户名,则会显示消息
"The Username or Password that you Entered is not Valid. Try Entering it Again"
.
这很好,但如果$dbActive
= 0,它应该只显示消息
You Must Activate Your Account from Email to Login
.
但相反,当发生这种情况时它会显示两条消息,因此它会显示
You Must Activate Your Account from Email to LoginThe Username or Password that you Entered is not Valid. Try Entering it Again
.
我知道为什么会这样,但我似乎无法弄清楚。$dbActive
如果= 0 ,如何阻止它显示两条消息?