Exemplo n.º 1
0
function checkpass($username, $password, $safecv, $lgt = 0)
{
    global $db_ifsafecv, $db_ifpwcache, $db, $timestamp, $onlineip;
    if (!checkLgt($lgt)) {
        //Showmsg('login_errortype');
        return 'login_errortype';
    }
    require_once R_P . 'uc_client/uc_client.php';
    $uc_user = uc_user_login($username, $password, $lgt);
    if ($uc_user['status'] == -1) {
        $GLOBALS['errorname'] = $username;
        //Showmsg('user_not_exists');
        return 'user_not_exists';
    }
    if ($uc_user['status'] == -3) {
        //Showmsg('reg_email_have_same');
        return 'reg_email_have_same';
    }
    if (!($men = getLoginUser($uc_user['uid']))) {
        $register = L::loadClass('Register');
        $register->appendUser($uc_user['uid'], $uc_user['username'], $password, $uc_user['email']);
        $men = getLoginUser($uc_user['uid']);
    }
    if (empty($men)) {
        $GLOBALS['errorname'] = $username;
        //Showmsg('user_not_exists');
        return 'user_not_exists';
    }
    $e_login = explode("|", $men['onlineip']);
    if ($e_login[0] == $onlineip . ' *' && $timestamp - $e_login[1] < 600 && $e_login[2] < 2) {
        $GLOBALS['L_T'] = 600 - ($timestamp - $e_login[1]);
        //Showmsg('login_forbid');
        return 'login_forbid';
    }
    if ($men['yz'] > 1) {
        $GLOBALS['jihuo_uid'] = $men['uid'];
        //Showmsg('login_jihuo');
        return 'login_jihuo';
    }
    if ($uc_user['status'] == -2 || $db_ifsafecv && $men['safecv'] != $safecv) {
        global $L_T;
        $L_T = $timestamp - $e_login[1] > 600 ? 6 : intval($e_login[2]);
        $L_T--;
        $F_login = "******";
        $db->update("UPDATE pw_memberdata SET onlineip=" . pwEscape($F_login) . " WHERE uid=" . pwEscape($uc_user['uid']));
        //Showmsg('login_pwd_error');
        return 'login_pwd_error';
    }
    $diff_sql = array();
    if ($men['password'] != $password) {
        $diff_sql['password'] = $password;
    }
    if ($men['email'] != $uc_user['email']) {
        $diff_sql['email'] = $uc_user['email'];
    }
    if ($diff_sql) {
        $db->update("UPDATE pw_members SET " . pwSqlSingle($diff_sql) . ' WHERE uid=' . pwEscape($uc_user['uid']));
    }
    $winduid = $men['uid'];
    $groupid = $men['groupid'] == '-1' ? $men['memberid'] : $men['groupid'];
    $windpwd = PwdCode($password);
    //Start Here会员排行榜
    if ($db_ifpwcache & 1) {
        require_once R_P . 'lib/elementupdate.class.php';
        $elementupdate = new ElementUpdate();
        $elementupdate->userSortUpdate($men);
    }
    //End Here
    return array($winduid, $groupid, $windpwd, $uc_user['synlogin']);
}
Exemplo n.º 2
0
function checkpass($username, $password, $safecv, $lgt = 0, $checkQuestion = true)
{
    global $db_ifsafecv, $db_ifpwcache, $db, $timestamp, $onlineip;
    if (!checkLgt($lgt)) {
        //Showmsg('login_errortype');
        return 'login_errortype';
    }
    require_once R_P . 'uc_client/uc_client.php';
    $uc_user = uc_user_login($username, $password, $lgt);
    if ($uc_user['status'] == -1) {
        $GLOBALS['errorname'] = $username;
        //Showmsg('user_not_exists');
        return 'user_not_exists';
    }
    if ($uc_user['status'] == -3) {
        //Showmsg('reg_email_have_same');
        return 'reg_email_have_same';
    }
    if (!($men = getLoginUser($uc_user['uid']))) {
        $register = L::loadClass('Register', 'user');
        $register->appendUser($uc_user['uid'], $uc_user['username'], $password, $uc_user['email']);
        $men = getLoginUser($uc_user['uid']);
    }
    if (empty($men)) {
        $GLOBALS['errorname'] = $username;
        //Showmsg('user_not_exists');
        return 'user_not_exists';
    }
    $e_login = explode("|", $men['onlineip']);
    if ($e_login[0] == $onlineip . ' *' && $timestamp - $e_login[1] < 600 && $e_login[2] < 1) {
        $GLOBALS['L_T'] = 600 - ($timestamp - $e_login[1]);
        //Showmsg('login_forbid');
        return 'login_forbid';
    }
    if ($uc_user['status'] == -2 || $db_ifsafecv && $checkQuestion == true && $men['safecv'] != $safecv) {
        global $L_T;
        $L_T = $timestamp - $e_login[1] > 600 ? 6 : intval($e_login[2]);
        $L_T--;
        $F_login = "******";
        $userService = L::loadClass('UserService', 'user');
        /* @var $userService PW_UserService */
        $userService->update($uc_user['uid'], array(), array('onlineip' => $F_login));
        //Showmsg('login_pwd_error');
        if ($uc_user['status'] == -2) {
            return 'login_usernamepwd_error';
        } elseif ($db_ifsafecv && $men['safecv'] != $safecv) {
            if ($checkQuestion) {
                return 'login_safecv_error';
            }
        } else {
            return 'login_pwd_error';
        }
    }
    if ($men['yz'] > 1) {
        $GLOBALS['jihuo_uid'] = $men['uid'];
        //Showmsg('login_jihuo');
        return 'login_jihuo';
    }
    $diff_sql = array();
    if ($men['password'] != $password) {
        $diff_sql['password'] = $password;
    }
    if ($men['email'] != $uc_user['email']) {
        $diff_sql['email'] = $uc_user['email'];
    }
    if ($diff_sql) {
        $userService = L::loadClass('UserService', 'user');
        /* @var $userService PW_UserService */
        $userService->update($uc_user['uid'], $diff_sql);
    }
    $winduid = $men['uid'];
    $groupid = $men['groupid'] == '-1' ? $men['memberid'] : $men['groupid'];
    $windpwd = PwdCode($password);
    //Start Here会员排行榜
    if ($db_ifpwcache & 1) {
        L::loadClass('elementupdate', '', false);
        $elementupdate = new ElementUpdate();
        $elementupdate->userSortUpdate($men);
    }
    //End Here
    //pig-head recycle
    $user_icon = explode('|', $men['icon']);
    if ($user_icon[4] && $men['tooltime'] < $timestamp - 86400) {
        $user_icon[4] = 0;
        $men['icon'] = implode('|', $user_icon);
        pwQuery::update('pw_members', 'uid =:uid', array($winduid), array('icon' => $men['icon']));
    }
    //end
    return array($winduid, $groupid, $windpwd, $uc_user['synlogin'], $men['safecv']);
}