if($mybb->input['action'] == "login")
{
$plugins->run_hooks("member_login");
$member_loggedin_notice = "";
if($mybb->user['uid'] != 0)
{
$mybb->user['username'] = htmlspecialchars_uni($mybb->user['username']);
$lang->already_logged_in = $lang->sprintf($lang->already_logged_in, build_profile_link($mybb->user['username'], $mybb->user['uid']));
eval("\$member_loggedin_notice = \"".$templates->get("member_loggedin_notice")."\";");
}
// Checks to make sure the user can login; they haven't had too many tries at logging in.
// Is a fatal call if user has had too many tries. This particular check uses cookies, as a uid is not set yet
// and we can't check loginattempts in the db
login_attempt_check();
// Redirect to the page where the user came from, but not if that was the login page.
if(isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], "action=login") === false)
{
$redirect_url = htmlentities($_SERVER['HTTP_REFERER']);
}
else
{
$redirect_url = '';
}
$captcha = '';
// Show captcha image for guests if enabled and only if we have to do
if($mybb->settings['captchaimage'] && $do_captcha == true)
{
require_once MYBB_ROOT.'inc/class_captcha.php';
$login_captcha = new captcha(false, "post_captcha");
if($login_captcha->type == 1)
{
if(!$correct)
{
$login_captcha->build_captcha();
}
else
{
$captcha = $login_captcha->build_hidden_captcha();
}
}
elseif(in_array($login_captcha->type, array(2, 4, 5)))
{
$login_captcha->build_recaptcha();
}
if($login_captcha->html)
{
$captcha = $login_captcha->html;
}
}
$username = "";
$password = "";
if(isset($mybb->input['username']) && $mybb->request_method == "post")
{
$username = htmlspecialchars_uni($mybb->get_input('username'));
}
if(isset($mybb->input['password']) && $mybb->request_method == "post")
{
$password = htmlspecialchars_uni($mybb->get_input('password'));
}
if(!empty($errors))
{
$mybb->input['action'] = "login";
$mybb->request_method = "get";
$inline_errors = inline_error($errors);
}
switch($mybb->settings['username_method'])
{
case 1:
$lang->username = $lang->username1;
break;
case 2:
$lang->username = $lang->username2;
break;
default:
break;
}
$plugins->run_hooks("member_login_end");
eval("\$login = \"".$templates->get("member_login")."\";");
output_page($login);
}