/** * 创建用户 * @param $obj * @return array|bool|null */ function create_member($obj) { require ROOT . "data/config.php"; require ROOT . "include/fun_user.php"; $pwd_hash = randstr(); $name_rand = randusername(); $password_hash = md5(md5($pwd_hash) . $pwd_hash . $QS_pwdhash); $setsqlarr['username'] = strtolower("em_" . $name_rand); $setsqlarr['password'] = $password_hash; $setsqlarr['pwd_hash'] = $pwd_hash; $new = \ORM::for_table(table('members'))->create(); $new->utype = 2; $new->username = $setsqlarr['username']; $new->email = $obj["email"]; $new->email_audit = 0; $new->mobile = str_replace("086-", "", $obj["telephone"]); $new->mobile_audit = 0; $new->password = $setsqlarr['password']; $new->pwd_hash = $setsqlarr['pwd_hash']; $new->reg_time = time(); $new->reg_ip = ''; $new->last_login_time = 0; $new->last_login_ip = ''; $new->qq_openid = ''; $new->sina_access_token = ''; $new->taobao_access_token = ''; $new->qq_nick = ''; $new->sina_nick = ''; $new->taobao_nick = ''; $new->weixin_nick = ''; $new->qq_binding_time = 0; $new->sina_binding_time = 0; $new->taobao_binding_time = 0; $new->status = 1; $new->avatars = ''; $new->robot = 0; $new->consultant = 0; $new->weixin_openid = ''; $new->bindingtime = 0; $new->remind_email_time = 0; $new->imei = ''; $new->sms_num = 0; $new->reg_type = 1; $new->status = 0; $rs = $new->save(); if ($rs) { return $new->id; } return false; }
function user_register($reg_type, $password, $member_type = 0, $email = "", $mobile = "", $uc_reg = true, $username = "", $weixin_openid = "", $weixin_nickname = "") { global $db, $timestamp, $_CFG, $online_ip, $QS_pwdhash; $member_type = intval($member_type); $reg_type = intval($reg_type); $email = trim($email); $email_audit = intval($email_audit); $mobile = trim($mobile); $ck_email = get_user_inemail($email); $ck_mobile = get_user_inmobile($mobile); if ($member_type == 0 || $reg_type == 0) { return -1; } elseif ($reg_type == 2 && !empty($ck_email)) { return -2; } elseif ($reg_type == 1 && !empty($ck_mobile)) { return -3; } $pwd_hash = randstr(); $name_rand = randusername(); $password_hash = md5(md5($password) . $pwd_hash . $QS_pwdhash); if (!$username) { if ($reg_type == 1) { // 手机注册用户名类型 1->手机号 2->前缀+手机号 3->前缀+随机字符 if ($_CFG['reg_mobile_type'] == "1") { $setsqlarr['username'] = $mobile; } elseif ($_CFG['reg_mobile_type'] == "2") { $setsqlarr['username'] = strtolower($_CFG['reg_prefix'] . $mobile); } else { $setsqlarr['username'] = strtolower($_CFG['reg_prefix'] . $name_rand); } } elseif ($reg_type == 2) { // 邮箱注册用户名类型 1->邮箱地址 2->前缀+邮箱地址 3->前缀+随机字符 if ($_CFG['reg_email_type'] == "1") { $setsqlarr['username'] = $email; } elseif ($_CFG['reg_email_type'] == "2") { $setsqlarr['username'] = strtolower($_CFG['email_reg_prefix'] . $email); } else { $setsqlarr['username'] = strtolower($_CFG['email_reg_prefix'] . $name_rand); } } else { $setsqlarr['username'] = strtolower($_CFG['third_reg_prefix'] . $name_rand); } } else { $ck_uname = get_user_inusername($username); if (!empty($ck_uname)) { return -4; } else { $setsqlarr['username'] = $username; } } $setsqlarr['password'] = $password_hash; $setsqlarr['pwd_hash'] = $pwd_hash; if ($email) { $setsqlarr['email'] = $email; if ($_CFG['check_reg_email'] == "1" && $reg_type != 3 && $reg_type != 4) { $setsqlarr['email_audit'] = 1; } else { $setsqlarr['email_audit'] = 0; } } if ($mobile) { $setsqlarr['mobile'] = $mobile; if ($reg_type != 3 && $reg_type != 4) { $setsqlarr['mobile_audit'] = 1; } } $setsqlarr['utype'] = $member_type; $setsqlarr['reg_time'] = $timestamp; $setsqlarr['reg_ip'] = $online_ip; $setsqlarr['reg_type'] = 1; if ($weixin_openid != '') { $setsqlarr['weixin_nick'] = $weixin_nickname; $setsqlarr['weixin_openid'] = $weixin_openid; $setsqlarr['bindingtime'] = $setsqlarr['reg_time']; $w_uid = $db->getone("select uid from " . table("members") . " where weixin_openid='" . $weixin_openid . "'"); if ($w_uid) { return $w_uid['uid']; } } $insert_id = $db->inserttable(table('members'), $setsqlarr, true); if ($member_type == "1") { $setarr['uid'] = $insert_id; if (!$db->inserttable(table("members_points"), $setarr)) { return false; } if (!$db->inserttable(table("members_setmeal"), $setarr)) { return false; } $points = get_cache('points_rule'); include_once QISHI_ROOT_PATH . 'include/fun_company.php'; set_consultant($insert_id); if ($points['reg_points']['value'] > 0) { report_deal($insert_id, $points['reg_points']['type'], $points['reg_points']['value']); $operator = $points['reg_points']['type'] == "1" ? "+" : "-"; write_memberslog($insert_id, 1, 9001, $username, "新注册会员,({$operator}{$points['reg_points']['value']}),(剩余:{$points['reg_points']['value']})", 1, 1010, "注册会员系统自动赠送积分", "{$operator}{$points['reg_points']['value']}", "{$points['reg_points']['value']}"); //积分变更记录 write_setmeallog($insert_id, $username, "注册会员系统自动赠送:({$operator}{$points['reg_points']['value']}),(剩余:{$points['reg_points']['value']})", 1, '0.00', '1', 1, 1); } if ($_CFG['reg_service'] > 0) { set_members_setmeal($insert_id, $_CFG['reg_service']); $setmeal = get_setmeal_one($_CFG['reg_service']); write_memberslog($insert_id, 1, 9002, $username, "注册会员系统自动赠送:{$setmeal['setmeal_name']}", 2, 1011, "开通服务(系统赠送)", "-", "-"); //套餐变更记录 write_setmeallog($insert_id, $username, "注册会员系统自动赠送:{$setmeal['setmeal_name']}", 1, '0.00', '1', 2, 1); } } elseif ($member_type == '2') { $setarr['uid'] = $insert_id; if (!$db->inserttable(table("members_points"), $setarr)) { return false; } $points = get_cache('points_rule'); include_once QISHI_ROOT_PATH . 'include/fun_personal.php'; if ($points['reg_per_points']['value'] > 0) { report_deal($insert_id, $points['reg_per_points']['type'], $points['reg_per_points']['value']); $operator = $points['reg_per_points']['type'] == "1" ? "+" : "-"; write_memberslog($insert_id, 2, 9001, $username, "新注册会员,({$operator}{$points['reg_per_points']['value']}),(剩余:{$points['reg_per_points']['value']})", 2, 1010, "注册会员系统自动赠送积分", "{$operator}{$points['reg_per_points']['value']}", "{$points['reg_per_points']['value']}"); } } elseif ($member_type == '4') { $setarr['uid'] = $insert_id; if (!$db->inserttable(table("members_points"), $setarr)) { return false; } if (!$db->inserttable(table("members_train_setmeal"), $setarr)) { return false; } $points = get_cache('points_rule'); if ($points['trainreg_points']['value'] > 0) { include_once QISHI_ROOT_PATH . 'include/fun_train.php'; report_deal($insert_id, $points['trainreg_points']['type'], $points['trainreg_points']['value']); $operator = $points['trainreg_points']['type'] == "1" ? "+" : "-"; write_memberslog($insert_id, 4, 9101, $username, "新注册会员,({$operator}{$points['trainreg_points']['value']}),(剩余:{$points['trainreg_points']['value']})"); write_setmeallog($insert_id, $username, "注册会员系统自动赠送:({$operator}{$points['trainreg_points']['value']}),(剩余:{$points['trainreg_points']['value']})", 1, '0.00', '1', 1, 4); } if ($_CFG['train_reg_service'] > 0) { include_once QISHI_ROOT_PATH . 'include/fun_train.php'; set_members_setmeal($insert_id, $_CFG['train_reg_service']); $setmeal = get_setmeal_one($_CFG['train_reg_service']); write_memberslog($insert_id, 4, 9102, $username, "注册会员系统自动赠送:{$setmeal['setmeal_name']}"); write_setmeallog($insert_id, $username, "注册会员系统自动赠送:{$setmeal['setmeal_name']}", 1, '0.00', '1', 2, 4); } } elseif ($member_type == '3') { $setarr['uid'] = $insert_id; if (!$db->inserttable(table("members_points"), $setarr)) { return false; } if (!$db->inserttable(table("members_hunter_setmeal"), $setarr)) { return false; } $points = get_cache('points_rule'); if ($points['hunterreg_points']['value'] > 0) { include_once QISHI_ROOT_PATH . 'include/fun_hunter.php'; report_deal($insert_id, $points['hunterreg_points']['type'], $points['hunterreg_points']['value']); $operator = $points['hunterreg_points']['type'] == "1" ? "+" : "-"; write_memberslog($insert_id, 3, 9201, $username, "新注册会员,({$operator}{$points['hunterreg_points']['value']}),(剩余:{$points['hunterreg_points']['value']})"); write_setmeallog($insert_id, $username, "注册会员系统自动赠送:({$operator}{$points['hunterreg_points']['value']}),(剩余:{$points['hunterreg_points']['value']})", 1, '0.00', '1', 1, 3); } if ($_CFG['hunter_reg_service'] > 0) { include_once QISHI_ROOT_PATH . 'include/fun_hunter.php'; set_members_setmeal($insert_id, $_CFG['hunter_reg_service']); $setmeal = get_setmeal_one($_CFG['hunter_reg_service']); write_memberslog($insert_id, 3, 9202, $username, "注册会员系统自动赠送:{$setmeal['setmeal_name']}"); write_setmeallog($insert_id, $username, "注册会员系统自动赠送:{$setmeal['setmeal_name']}", 1, '0.00', '1', 2, 3); } } if (defined('UC_API') && $uc_reg) { include_once QISHI_ROOT_PATH . 'uc_client/client.php'; $uc_reg_uid = uc_user_register($username, $password, $email); } write_memberslog($insert_id, $member_type, 1000, $username, "注册成为会员"); return $insert_id; }
$setsqlarr['intention_jobs'] = trim($_POST['intention_jobs']) ? trim($_POST['intention_jobs']) : exit('请选择期望职位'); $setsqlarr['district_cn'] = trim($_POST['district_cn']) ? trim($_POST['district_cn']) : exit('请选择期望地区'); $setsqlarr['wage'] = trim($_POST['wage']) ? trim($_POST['wage']) : exit('请选择期望薪资'); $setsqlarr['wage_cn'] = trim($_POST['wage_cn']); $setsqlarr['telephone'] = trim($_POST['telephone']) ? trim($_POST['telephone']) : exit('请填写手机号'); $setsqlarr['addtime'] = $time; $setsqlarr['refreshtime'] = $time; $setsqlarr['audit'] = 1; $setsqlarr['resume_from_pc'] = 4; if (get_user_inmobile($setsqlarr['telephone'])) { exit("手机号已经被注册过,重新填写!"); } $setsqlarr['current'] = intval($_POST['current']) ? intval($_POST['current']) : exit('请选择目前状态'); $setsqlarr['current_cn'] = trim($_POST['current_cn']); // 注册会员 $user_arr['username'] = "******" . randusername(); $user_arr['utype'] = 2; $user_arr['mobile'] = $setsqlarr['telephone']; $user_arr['mobile_audit'] = 1; $user_arr['pwd_hash'] = randstr(); $user_arr['password'] = md5(md5('123456') . $user_arr['pwd_hash'] . $QS_pwdhash); $user_arr['reg_time'] = $timestamp; $user_arr['reg_ip'] = $online_ip; $insert_id = $db->inserttable(table('members'), $user_arr, true); if ($insert_id) { // 登录 $login = user_login($user_arr['username'], '123456'); // 添加会员信息 $user_info['uid'] = $insert_id; $user_info['realname'] = $setsqlarr['fullname']; $user_info['sex'] = $setsqlarr['sex'];
$utype = intval($_GET['utype']); $weixin_openid = $_GET['openid']; $event_key = $_GET['event_key']; if (file_exists(QISHI_ROOT_PATH . "data/weixin/" . $event_key % 10 . '/' . $event_key . ".txt")) { $access_token = get_access_token(); $w_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $access_token . "&openid=" . $weixin_openid . "&lang=zh_CN"; $w_result = https_request($w_url); $w_userinfo = json_decode($w_result, true); $w_userinfo = array_map('utf8_to_gbk', $w_userinfo); // 微信扫码注册用户名类型 前缀+随机字符 $username = $_CFG['third_reg_prefix'] . randusername(); // 微信扫码注册用户密码类型 1->与用户名相同 2->随机密码 3->指定密码 if ($_CFG['reg_weixin_password_tpye'] == "1") { $password = $username; } elseif ($_CFG['reg_weixin_password_tpye'] == "2") { $password = randusername(); } else { $password = $_CFG['reg_weixin_password']; } $insert_id = user_register(3, $password, $utype, "", "", false, $username, $weixin_openid, $w_userinfo['nickname']); if ($insert_id > 0) { $smarty->assign('utype_cn', $utype == 1 ? '企业会员' : '个人会员'); $smarty->assign('username', $username); $smarty->assign('password', $password); weixin_login($weixin_openid, $insert_id, $event_key); $smarty->display('m/scan/scan_reg_success.html'); } else { exit('err'); } } else { exit('err');