我正在修复的项目的登录页面显示为空白。我试着回应一些话来找出错误撒谎的地方。我发现注释下面的代码使它显示出来。
elseif( isset($_POST['do_login'] ) ){ //Login user
$email = (isset($_POST['login']) && is_string($_POST['login'])
&& strlen($_POST['login'])<100)?$_POST['login'] : null;
$password = (isset($_POST['password']) && is_string($_POST['password'])
&& strlen($_POST['password'])<100)?$_POST['password'] : null;
$remember = isset($_POST['chkremember']) ? true : false;
$result = $auth->login($email, $password, $remember);
switch($result){
case 1:
$msg = 'You have successfully logged in.'
break;
case 2:
$msg = 'Your account has not yet been confirmed. <br/> Please check the e-mail message sent by us and click the confirmation code to validate this account. <a href="user_login.php?view=resend&resend_email='.$email.'">resend activation e-mail</a>';
break;
case 3:
$msg = 'Your account is not enabled!';
break;
case 4:
$msg = 'Account with given login credentials does not exist!';
break;
}
}
任何人都可以帮我弄清楚这段代码有什么问题吗?
答案 0 :(得分:2)
case 1
中,您在;
之前错过break
。
答案 1 :(得分:1)
case 1: $msg = 'You have successfully logged in.' break;
分钟前分号丢失;