コード例 #1
0
function forget_password($username, $email)
{
    if (mb_strlen($username, 'utf8') < 1 || mb_strlen($username, 'utf8') > 12) {
        return 'User not exist';
    }
    if (!preg_match("/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)\$/i", $email)) {
        return 'User not exist';
    }
    $sql = "SELECT username, verified, auth_key, last_time FROM `account` WHERE email=? AND username =? LIMIT 1";
    $params = array($email, $username);
    $result = (new MysqlDAO())->executeQuery($sql, $params, 'ss');
    if (count($result) != 1) {
        return 'User not exist';
    }
    if ($result[0]['verified'] == 'b') {
        return 'Your account is blocked';
    }
    if ($result[0]['verified'] == 'f') {
        return 'Email is not verified';
    }
    $auth_key = $result[0]['auth_key'];
    $last_time = $result[0]['last_time'];
    $ip = ip2long(get_ip());
    $auth_key = process_auth_key($auth_key, $last_time);
    $res = send_forget_pass_mail($username, $email, $auth_key, $ip);
    return $res;
}
コード例 #2
0
ファイル: functions-account.php プロジェクト: newnius/jluewu
function forget_password($username, $email)
{
    if (is_name_valid($username) != '' || is_email_valid($email) != '') {
        return '用户不存在';
    }
    $profile = get_user_information($username);
    if ($profile == null) {
        return '用户不存在';
    }
    if ($profile['email'] != $email) {
        return '用户不存在';
    }
    if ($profile['verified'] == 'b') {
        return '您的帐号已被锁定';
    }
    /*
    if($profile['email_verified'] == 'f'){ return '邮箱尚未验证';	}
    */
    $auth_key = process_auth_key($profile['auth_key'], $profile['last_time']);
    return send_forget_pass_mail($username, $email, ip2long(get_ip()), $auth_key);
}