function login_check() { global $smarty; $email = @$_POST['email']; $pass = @$_POST['loginpass']; if (login_needcaptcha()) { if (recaptcha_verify() !== true) { login_error(_('The CAPTCHA you entered is incorrect')); die; } } $ret = user_verify($email, $pass); if ($ret !== true) { login_incfail(); login_error($ret); die; } else { user_online($email); login_resetfail(); $url = 'account.php'; header("Location: {$url}"); $smarty->assign('url', $url); $smarty->display('templates/redirect.html'); } }
function reg_save() { global $smarty; $email = @$_POST['email']; $pass = @$_POST['loginpass']; $pass2 = @$_POST['loginpass2']; if ($pass == '' || $email == '') { reg_main(_('Please enter email and password')); return false; } if (strpos($email, '@') == false || strpos($email, '.') == false) { reg_main(_('Invalid email address')); return false; } if ($pass != $pass2) { reg_main(_('Password does not match')); return false; } if (recaptcha_verify() !== true) { reg_main(_('The CAPTCHA you enter is not correct')); return false; } if (INVITECODE_ENABLED == 1 && reg_checkinvite(@$_POST['invitecode']) == false) { reg_main(_('The invite code is invalid or have been used')); return false; } $ret = user_add($email, $pass); if ($ret !== true) { reg_main("<p>{$ret}</p>" . _('<p>Register fail, please contact us for help if you need.</p>')); return false; } $user = user_get($email); if (INVITECODE_ENABLED == 1) { invite_use($_POST['invitecode'], $user['id']); } user_online($email); $smarty->assign('tip_title', _('Register successed')); $smarty->assign('tip_msg', _('You have registerd successfully')); $smarty->assign('redirect_url', 'account.php'); $smarty->display('tip.html'); }