예제 #1
0
파일: fun_user.php 프로젝트: dalinhuang/yy
function user_login($account, $password, $account_type = 1, $uc_login = true, $expire = NULL)
{
    global $timestamp, $online_ip, $QS_pwdhash;
    $usinfo = $login = array();
    $success = false;
    if ($account_type == "1") {
        $usinfo = get_user_inusername($account);
    } elseif ($account_type == "2") {
        $usinfo = get_user_inemail($account);
    } elseif ($account_type == "3") {
        $usinfo = get_user_inmobile($account);
    }
    if (!empty($usinfo)) {
        $pwd_hash = $usinfo['pwd_hash'];
        $usname = addslashes($usinfo['username']);
        $pwd = md5(md5($password) . $pwd_hash . $QS_pwdhash);
        if ($usinfo['password'] == $pwd) {
            update_user_info($usinfo['uid'], true, true, $expire);
            $login['qs_login'] = get_member_url($usinfo['utype']);
            $success = true;
            write_memberslog($usinfo['uid'], $usinfo['utype'], 1001, $usname, "成功登录");
        } else {
            $usinfo = '';
            $success = false;
        }
    }
    return $login;
}
예제 #2
0
파일: fun_wap.php 프로젝트: winiceo/fenzhan
function user_login_new($account, $account_type = 1, $uc_login = true, $expire = NULL)
{
    global $timestamp, $online_ip, $QS_pwdhash;
    $usinfo = $login = array();
    $success = false;
    if ($account_type == "1") {
        $usinfo = get_user_inusername($account);
    } elseif ($account_type == "2") {
        $usinfo = get_user_inemail($account);
    } elseif ($account_type == "3") {
        $usinfo = get_user_inmobile($account);
    }
    if (!empty($usinfo)) {
        wap_update_user_info($usinfo['uid'], true);
        return true;
    }
    return false;
}
예제 #3
0
 }
 $getusername = get_user_inusername($setsqlarr['username']);
 if (!empty($getusername) && $getusername['uid'] != $thisuid) {
     adminmsg("用户名 {$setsqlarr['username']}  已经存在!", 1);
 }
 if (empty($setsqlarr['email']) || !preg_match("/^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$/", $setsqlarr['email'])) {
     adminmsg('电子邮箱格式错误!', 1);
 }
 $getemail = get_user_inemail($setsqlarr['email']);
 if (!empty($getemail) && $getemail['uid'] != $thisuid) {
     adminmsg("Email  {$setsqlarr['email']}  已经存在!", 1);
 }
 if (!empty($setsqlarr['mobile']) && !preg_match("/^(13|15|18)\\d{9}\$/", $setsqlarr['mobile'])) {
     adminmsg('手机号码错误!', 1);
 }
 $getmobile = get_user_inmobile($setsqlarr['mobile']);
 if (!empty($setsqlarr['mobile']) && !empty($getmobile) && $getmobile['uid'] != $thisuid) {
     adminmsg("手机号 {$setsqlarr['mobile']}  已经存在!", 1);
 }
 if ($_POST['tpl']) {
     $tplarr['tpl'] = trim($_POST['tpl']);
     updatetable(table('company_profile'), $tplarr, " uid='{$thisuid}'");
     updatetable(table('jobs'), $tplarr, " uid='{$thisuid}'");
     updatetable(table('jobs_tmp'), $tplarr, " uid='{$thisuid}'");
     unset($tplarr);
 }
 if (updatetable(table('members'), $setsqlarr, " uid=" . $thisuid . "")) {
     $link[0]['text'] = "返回列表";
     $link[0]['href'] = $_POST['url'];
     adminmsg('修改成功!', 2, $link);
 } else {
예제 #4
0
파일: fun_user.php 프로젝트: winiceo/job
function user_login($account, $password, $account_type = 1, $uc_login = true, $expire = NULL)
{
    global $timestamp, $online_ip, $QS_pwdhash;
    $usinfo = $login = array();
    $success = false;
    if ($account_type == "1") {
        $usinfo = get_user_inusername($account);
    } elseif ($account_type == "2") {
        $usinfo = get_user_inemail($account);
    } elseif ($account_type == "3") {
        $usinfo = get_user_inmobile($account);
    }
    if (!empty($usinfo)) {
        $pwd_hash = $usinfo['pwd_hash'];
        $usname = addslashes($usinfo['username']);
        $pwd = md5(md5($password) . $pwd_hash . $QS_pwdhash);
        if ($usinfo['password'] == $pwd) {
            if ($usinfo['status'] == 2) {
                $usinfo = '';
                $success = false;
                $login['qs_login'] = '******';
            } else {
                update_user_info($usinfo['uid'], true, true, $expire);
                $login['qs_login'] = get_member_url($usinfo['utype']);
                $success = true;
                write_memberslog($usinfo['uid'], $usinfo['utype'], 1001, $usname, "成功登录");
            }
        } else {
            $usinfo = '';
            $success = false;
        }
    }
    if (defined('UC_API') && $uc_login) {
        include_once QISHI_ROOT_PATH . 'uc_client/client.php';
        $account = $usinfo['username'] ? $usinfo['username'] : $account;
        list($uc_uid, $uc_username, $uc_password, $uc_email) = uc_user_login($account, $password);
        if ($uc_uid > 0) {
            $login['uc_login'] = uc_user_synlogin($uc_uid);
            if ($success == false) {
                global $_CFG;
                $_SESSION['activate_username'] = $uc_username;
                $login['qs_login'] = $_CFG['site_dir'] . "user/user_reg.php?act=activate";
            }
        } elseif ($uc_uid === -1 && $success) {
            $uc_reg_uid = uc_user_register($usinfo['username'], $password, $usinfo['email']);
            if ($uc_reg_uid > 0) {
                $login['uc_login'] = uc_user_synlogin($uc_reg_uid);
            }
        }
    }
    return $login;
}
예제 #5
0
        $smarty->assign('type', $type);
        $smarty->assign('username', $username);
        $smarty->display('m/password-set-new.html');
    }
} elseif ($act == 'set_pass_save') {
    global $QS_pwdhash;
    $_POST = array_map("utf8_to_gbk", $_POST);
    $username = trim($_POST['username']);
    $password = trim($_POST['password']);
    $password_two = trim($_POST['password_two']);
    if (empty($username) || empty($password) || empty($password_two)) {
        exit('信息丢失!');
    }
    if ($password != $password_two) {
        exit('两次输入的密码不同!');
    }
    if (preg_match("/^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$/", $username)) {
        $userinfo = get_user_inemail($username);
    } elseif (preg_match("/^(13|14|15|17|18)\\d{9}\$/", $username)) {
        $userinfo = get_user_inmobile($username);
    }
    $password_hash = md5(md5($password) . $userinfo['pwd_hash'] . $QS_pwdhash);
    $setsqlarr['password'] = $password_hash;
    $rst = $db->updatetable(table('members'), $setsqlarr, array("uid" => $userinfo['uid']));
    if ($rst) {
        exit('ok');
    } else {
        exit('设置新密码失败!');
    }
}
unset($smarty);
예제 #6
0
 if ($sql['password'] != trim($_POST['password1'])) {
     adminmsg('两次输入的密码不相同!', 1);
 }
 $sql['utype'] = !empty($_POST['member_type']) ? intval($_POST['member_type']) : adminmsg('你没有选择注册类型!', 1);
 if (empty($_POST['email']) || !preg_match("/^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$/", $_POST['email'])) {
     adminmsg('电子邮箱格式错误!', 1);
 }
 $sql['email'] = trim($_POST['email']);
 $sql['username'] = $sql['email'];
 if (get_user_inusername($sql['username'])) {
     adminmsg('该用户名已经被使用!', 1);
 }
 if (get_user_inemail($sql['email'])) {
     adminmsg('该 Email 已经被注册!', 1);
 }
 if (get_user_inmobile($sql['mobile'])) {
     adminmsg('该 手机号 已经被注册!', 1);
 }
 if (defined('UC_API')) {
     include_once QISHI_ROOT_PATH . 'uc_client/client.php';
     if (uc_user_checkname($sql['username']) != "1") {
         adminmsg('该用户名已经被使用或者用户名非法!', 1);
         exit;
     } elseif (uc_user_checkemail($sql['email']) != "1") {
         adminmsg('该 Email已经被使用或者非法!', 1);
         exit;
     } else {
         uc_user_register($sql['username'], $sql['password'], $sql['email']);
     }
 }
 $sql['pwd_hash'] = randstr();
예제 #7
0
function wap_user_login($account, $password, $account_type = 1, $uc_login = true, $expire = NULL)
{
    global $timestamp, $online_ip, $QS_pwdhash;
    $usinfo = $login = array();
    $success = false;
    if (preg_match("/^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$/", $account)) {
        $account_type = 2;
    } elseif (preg_match("/^(13|14|15|18)\\d{9}\$/", $account)) {
        $account_type = 3;
    }
    if ($account_type == "1") {
        $usinfo = get_user_inusername($account);
    } elseif ($account_type == "2") {
        $usinfo = get_user_inemail($account);
    } elseif ($account_type == "3") {
        $usinfo = get_user_inmobile($account);
    }
    if (!empty($usinfo)) {
        $pwd_hash = $usinfo['pwd_hash'];
        $usname = $usinfo['username'];
        $pwd = md5(md5($password) . $pwd_hash . $QS_pwdhash);
        if ($usinfo['password'] == $pwd) {
            wap_update_user_info($usinfo['uid'], true, true, $expire);
            $login['qs_login'] = get_member_wap_url($usinfo['utype']);
            $success = true;
        } else {
            $usinfo = '';
            $success = false;
        }
    }
    return $login;
}
예제 #8
0
    } else {
        exit("注册失败!");
    }
} elseif ($act == "check_mobile") {
    $mobile = trim($_POST['mobile']);
    if (empty($mobile) || !preg_match("/^(13|15|14|17|18)\\d{9}\$/", $mobile)) {
        exit("请输入正确的手机号!");
    }
    if (get_user_inmobile($mobile)) {
        exit("手机号已经存在,请换一个号码!");
    } else {
        exit('ok');
    }
} elseif ($act == "send_code") {
    $mobile = trim($_POST['mobile']);
    if (get_user_inmobile($mobile)) {
        exit("手机号已经存在,请换一个号码!");
    }
    $SMSconfig = get_cache('sms_config');
    if ($SMSconfig['open'] != "1") {
        exit("短信模块处于关闭状态");
    }
    if ($_SESSION['send_time'] && time() - $_SESSION['send_time'] < 100) {
        exit("请100秒后再进行操作!");
    }
    $rand = mt_rand(100000, 999999);
    $r = send_sms($mobile, "您正在{$_CFG['site_name']}经行快速创建简历,验证码为:{$rand}");
    if ($r == "success") {
        $_SESSION['mobile'] = $mobile;
        $_SESSION['mobile_rand'] = $rand;
        $_SESSION['send_time'] = time();
예제 #9
0
파일: user_reg.php 프로젝트: winiceo/job
    }
} elseif ($act == 'phone_reg') {
    $_POST = array_map("utf8_to_gbk", $_POST);
    require_once QISHI_ROOT_PATH . 'include/fun_wap.php';
    require_once QISHI_ROOT_PATH . 'include/fun_user.php';
    $mobile = trim($_POST['mobile']);
    $password_mobile = isset($_POST['password_mobile']) ? trim($_POST['password_mobile']) : "";
    $member_type = intval($_POST['utype']);
    $agreement_mobile = isset($_POST['agreement_mobile']) ? intval($_POST['agreement_mobile']) : "";
    if (empty($mobile) || empty($password_mobile) || empty($member_type)) {
        exit("信息不完整!");
    } elseif (empty($agreement_mobile)) {
        exit("需要同意注册协议");
    }
    //验证验证码是否正确
    $verifycode = trim($_POST['verifycode']);
    if (empty($verifycode) || empty($_SESSION['mobile_rand']) || $verifycode != $_SESSION['mobile_rand']) {
        exit("验证码错误!");
    }
    //手机号注册
    $register = user_register(1, $password_mobile, $member_type, $email = "", $mobile, false, $username = "", "");
    if ($register > 0) {
        $user_info = get_user_inmobile($mobile);
        $login_js = wap_user_login($user_info['username'], $password_mobile);
        if ($login_js) {
            exit($login_js['qs_login']);
        }
    } else {
        exit("user_reg.php");
    }
}