function loginsave_action() { $username = yun_iconv("utf-8", "gbk", $_POST['username']); if ($this->uid > 0 && $_COOKIE['username'] != "") { if ($_COOKIE['usertype'] == '1') { $this->ajaxlogin("您现在是个人会员登录状态!"); } elseif ($_COOKIE['usertype'] == '2') { $this->ajaxlogin("您现在是企业会员登录状态!"); } } if ($_POST['path'] != "index") { if (strstr($this->config['code_web'], '前台登陆')) { session_start(); if (md5($_POST['authcode']) != $_SESSION['authcode']) { unset($_SESSION['authcode']); $this->ajaxlogin("验证码错误!"); } } } if (!$this->CheckRegUser($username) && !$this->CheckRegEmail($username)) { $this->ajaxlogin("无效的用户名!"); } if ($username != "") { $Member = $this->MODEL("userinfo"); if ($this->config['sy_uc_type'] == "uc_center") { $this->uc_open(); $uname = $username; list($uid, $username, $password, $email) = uc_user_login($username, $_POST['password']); if ($uid < 1) { $user = $Member->GetMemberOne(array("username" => $uname), array("field" => "username,email,uid,password,salt")); $pass = md5(md5($_POST['password']) . $user['salt']); if ($pass == $user['password']) { $uid = $user['uid']; uc_user_register($user['username'], $_POST['password'], $user['email']); list($uid, $username, $password, $email) = uc_user_login($uname, $_POST['password']); } else { $this->ajaxlogin("账户或密码错误!"); } } else { if ($uid > 0) { $ucsynlogin = uc_user_synlogin($uid); $msg = '登录成功!'; $user = $Member->GetMemberOne(array("username" => $username), array("field" => "`uid`,`usertype`,`email_status`")); if (!empty($user)) { if (session_id() == "") { session_start(); } if ($_SESSION['qq']['openid']) { $Member->UpdateMember(array("qqid" => $_SESSION['qq']['openid']), array("username" => $username)); unset($_SESSION['qq']); } if ($_SESSION['wx']['openid']) { $udate = array('wxopenid' => $_SESSION['wx']['openid']); if ($_SESSION['wx']['unionid']) { $udate['unionid'] = $_SESSION['wx']['unionid']; } $Member->UpdateMember($udate, array("username" => $username)); unset($_SESSION['wx']); } if ($_SESSION['sina']['openid']) { $Member->UpdateMember(array("sinaid" => $_SESSION['sina']['openid']), array("username" => $username)); unset($_SESSION['sina']); } if (!$user['usertype']) { $this->unset_cookie(); $this->addcookie("username", $username, time() + 3600); $this->addcookie("password", $_POST['password'], time() + 3600); $this->ajaxlogin($ucsynlogin, Url("login", array("c" => "utype"), "1"), '3'); } if ($this->config['user_status'] == "1") { if ($user['email_status'] != "1") { $this->ajaxlogin("您的账户还未激活,请先激活!", Url("activate", '', "1")); die; } } if ($_POST['loginname']) { setcookie("loginname", $username, time() + 8640000); } $this->autoupjob($user['uid'], $user['usertype']); } else { $this->unset_cookie(); $this->addcookie("username", $username, time() + 3600); $this->addcookie("password", $_POST['password'], time() + 3600); $this->ajaxlogin($ucsynlogin, Url("login", array("c" => "utype"), "1"), '3'); } $this->ajaxlogin($ucsynlogin, $this->config['sy_weburl'] . "/member", '2'); } elseif ($uid == -1) { $msg = '用户不存在,或者被删除'; } elseif ($uid == -2) { $msg = '密码错误'; } else { $msg = '该用户未定义!'; } } $this->ajaxlogin($ucsynlogin, Url("login", array("c" => "utype"), "1"), '3'); } else { $user = $Member->GetMemberOne(array("username" => $username), array("field" => "`pw_repeat`,`pwuid`,`uid`,`username`,`salt`,`email`,`password`,`usertype`,`status`,`email_status`")); if ($this->config['sy_pw_type'] == "pw_center") { if ($user['pw_repeat'] != "1") { include APP_PATH . "/api/pw_api/pw_client_class_phpapp.php"; $pw = new PwClientAPI($username, $_POST['password'], ""); $pwuser = $pw->user_login(); if ($pwuser['uid'] > 0) { if (empty($user)) { $user = $this->newuser($Member, $pwuser['username'], $pwuser['password'], $pwuser['email'], $user['usertype'], $pwuser['uid'], $qqid); } else { if ($pwuser['uid'] == $user['pwuid']) { $pwrows = $pw->login($pwuser['uid']); $this->add_cookie($user['uid'], $user['username'], $user['salt'], $user['email'], $user['password'], $user['usertype'], $_POST['loginname']); $time = strtotime(date("Y-m-d")); $row = $Member->GetPayinfoOne(array("`com_id`='" . $user['uid'] . "' and `pay_time`>'" . $time . "' and `pay_remark`='会员登录'")); if (empty($row)) { $this->get_integral_action($user['uid'], "integral_login", "会员登录"); } $this->ajaxlogin('登录成功', '', '2'); } else { $Member->UpdateMember(array("pw_repeat" => "1"), array("uid" => $user['uid'])); } } } } } if (is_array($user)) { $pass = md5(md5($_POST['password']) . $user['salt']); if ($user['password'] == $pass) { if ($user['status'] == "2") { $this->ajaxlogin("您的账号已被锁定!", Url("register", array("c" => "ok", "type" => 2), "1")); } if ($user['usertype'] == "2" && $this->config['com_status'] != "1" && $user['status'] != "1") { $this->ajaxlogin("您还没有通过审核!", Url("register", array("c" => "ok", "type" => 3), "1")); } if ($this->config['user_status'] == "1" && $user['usertype'] == "1" && $user['email_status'] != "1") { $this->ajaxlogin("您的账户还未激活,请先激活!", Url("activate", '', "1")); } if (session_id() == "") { session_start(); } if ($_SESSION['qq']['openid']) { $Member->UpdateMember(array("qqid" => $_SESSION['qq']['openid']), array("username" => $username)); unset($_SESSION['qq']); } if ($_SESSION['wx']['openid']) { $udate = array('wxopenid' => $_SESSION['wx']['openid']); if ($_SESSION['wx']['unionid']) { $udate['unionid'] = $_SESSION['wx']['unionid']; } $Member->UpdateMember($udate, array("username" => $username)); unset($_SESSION['wx']); } if ($_SESSION['sina']['openid']) { $Member->UpdateMember(array("sinaid" => $_SESSION['sina']['openid']), array("username" => $username)); unset($_SESSION['sina']); } $time = time(); $ip = fun_ip_get(); $Member->UpdateMember(array("login_ip" => $ip, "login_date" => $time, "login_hits" => "`login_hits`+1"), array("uid" => $user['uid'])); $this->unset_cookie(); $this->add_cookie($user['uid'], $user['username'], $user['salt'], $user['email'], $user['password'], $user['usertype'], $_POST['loginname']); $time = strtotime(date("Y-m-d")); $row = $Member->GetPayinfoOne(array("`com_id`='" . $user['uid'] . "' and `pay_time`>'" . $time . "' and `pay_remark`='会员登录'")); if (empty($row)) { $this->get_integral_action($user['uid'], "integral_login", "会员登录"); } if ($qqid) { $Member->UpdateMember(array("qqid" => $qqid, "username" => $username), array("uid" => $user['uid'])); } if ($user['usertype'] == '1') { $Resume = $this->MODEL("resume"); $info = $Resume->SelectResumeOne(array("uid" => $user['uid']), "`name`,`birthday`"); } else { if ($user['usertype'] == '2') { $Company = $this->MODEL("company"); $info = $Company->GetCompanyInfo(array("uid" => $user['uid']), array("field" => 'name')); $this->autoupjob($user['uid'], $user['usertype']); } } if ($info['name']) { $this->ajaxlogin('登录成功', $this->config['sy_weburl'] . "/member", '1'); } else { if ($info['name'] == '') { $this->ajaxlogin('登录成功', $this->config['sy_weburl'] . "/member/index.php?c=info", '1'); } } } else { $this->ajaxlogin("密码不正确!"); } } else { $this->ajaxlogin("该用户不存在!"); } } } else { $this->ajaxlogin("用户名不能为空!"); } }
function regsave_action() { $_POST = $this->post_trim($_POST); $usertype = intval($_POST['usertype']); $_POST['username'] = yun_iconv("utf-8", "gbk", $_POST['username']); $_POST['unit_name'] = yun_iconv("utf-8", "gbk", $_POST['unit_name']); $_POST['address'] = yun_iconv("utf-8", "gbk", $_POST['address']); $_POST['linkman'] = yun_iconv("utf-8", "gbk", $_POST['linkman']); $_POST['name'] = yun_iconv("utf-8", "gbk", $_POST['name']); if ($_COOKIE['uid'] != "" && $_COOKIE['username'] != "") { $this->errjson('您已经登录了!'); } if (strpos($this->config['code_web'], '注册会员') !== false) { session_start(); if (md5($_POST['authcode']) != $_SESSION['authcode']) { $this->errjson('验证码错误!'); } } if (!$this->CheckRegUser($_POST['username']) && !$this->CheckRegEmail($_POST['username'])) { $this->errjson('用户名包含特殊字符!'); } $Member = $this->MODEL("userinfo"); if ($_POST['codeid'] == '1') { if ($this->config['reg_username'] == '1' && $usertype == '1') { if (!$this->CheckRegUser($_POST['name']) || $_POST['name'] == "") { $this->errjson('真实姓名格式不规范'); } } if ($this->config['reg_usertel'] == '1' && $usertype == '1' || $this->config['reg_comtel'] == '1' && $usertype == '2') { if (!preg_match("/1[34578]{1}\\d{9}\$/", $_POST['moblie'])) { $this->errjson('手机格式错误!'); } else { $moblieNum = $Member->GetMemberNum(array("moblie" => $_POST['moblie'])); if ($moblieNum > 0) { $this->errjson('手机已存在!'); } } } if ($this->config['reg_useremail'] == '1' && $usertype == '1' || $this->config['reg_comemail'] == '1' && $usertype == '2') { if (!$this->CheckRegEmail($_POST['email']) || $_POST['email'] == "") { $this->errjson('Email格式不规范!'); } } if ($usertype == '2') { if ($this->config['reg_comname'] == '1') { if (!$this->CheckRegUser($_POST['unit_name']) || $_POST['unit_name'] == "") { $this->errjson('请正确填写企业名称!'); } } if ($this->config['reg_comaddress'] == '1') { if (!$this->CheckRegUser($_POST['address']) || $_POST['address'] == "") { $this->errjson('请正确填写企业地址!'); } } if ($this->config['reg_comlink'] == '1') { if (!$this->CheckRegUser($_POST['linkman']) || $_POST['linkman'] == "") { $this->errjson('请正确填写企业联系人'); } } } } elseif ($_POST['codeid'] == '2') { if (!preg_match("/1[34578]{1}\\d{9}\$/", $_POST['moblie'])) { $this->errjson('手机格式错误!'); } if ($this->config['sy_msg_regcode'] == "1") { if ($_POST['moblie_code']) { $regCertMobile = $Member->GetCompanyCert(array("type" => '2', "check" => $_POST['moblie'])); } if ($regCertMobile['check2'] != $_POST['moblie_code'] || $regCertMobile['check2'] == '') { $this->errjson('短信验证码错误!'); } } $_POST['username'] = $_POST['moblie']; } elseif ($_POST['codeid'] == '3') { if (!$this->CheckRegEmail($_POST['email']) || $_POST['email'] == "") { $this->errjson('Email格式不规范!'); } $_POST['username'] = $_POST['email']; } if ($_POST['username'] != "") { $nid = $Member->GetMemberNum(array("username" => $_POST['username'])); if ($nid) { $this->errjson('账户名已存在!'); } else { if ($_POST['usertype'] == '1') { $satus = 1; } elseif ($_POST['usertype'] == '2') { $satus = $this->config['com_status']; } if ($this->config['sy_uc_type'] == "uc_center") { $this->uc_open(); $uid = uc_user_register($_POST['username'], $_POST['password'], $_POST['email']); if ($uid <= 0) { $this->errjson('该邮箱已存在!'); } else { list($uid, $username, $password, $email, $salt) = uc_user_login($_POST['username'], $_POST['password']); $pass = md5(md5($_POST['password']) . $salt); $ucsynlogin = uc_user_synlogin($uid); } } elseif ($this->config['sy_pw_type'] == "pw_center") { include APP_PATH . "/api/pw_api/pw_client_class_phpapp.php"; $password = $_POST['password']; $email = $_POST['email']; $pw = new PwClientAPI($username, $password, $email); $pwuid = $pw->register(); $salt = substr(uniqid(rand()), -6); $pass = md5(md5($password) . $salt); } else { $salt = substr(uniqid(rand()), -6); $pass = md5(md5($_POST['password']) . $salt); } $ip = fun_ip_get(); $data['username'] = $_POST['username']; $data['password'] = $pass; $data['usertype'] = $_POST['usertype']; $data['email'] = $_POST['email']; $data['moblie'] = $_POST['moblie']; $data['status'] = $satus; $data['salt'] = $salt; $data['reg_date'] = time(); $data['reg_ip'] = $ip; $data['qqid'] = $_SESSION['qq']['openid']; $data['sinaid'] = $_SESSION['sina']['openid']; $data['wxid'] = $_SESSION['wx']['openid']; $data['regcode'] = (int) $_COOKIE['regcode']; $userid = $Member->AddMember($data); if (!$userid) { $user_id = $Member->GetMemberOne(array("username" => $_POST['username']), array("field" => "uid")); $userid = $user_id['uid']; } if ($userid) { $this->unset_cookie(); if ($this->config['sy_pw_type'] == "pw_center") { $Member->UpdateMember(array("pwuid" => $pwuid), array("uid" => $userid)); } if ($_POST['usertype'] == "1") { $table = "member_statis"; $table2 = "resume"; $data1 = array("uid" => $userid); $data2 = array("uid" => $userid, "email" => $_POST['email'], "telphone" => $_POST['moblie'], "name" => $_POST['name']); } elseif ($_POST['usertype'] == "2") { $table = "company_statis"; $table2 = "company"; $data1 = $Member->FetchRatingInfo(array("uid" => $userid)); $data2['uid'] = $userid; $data2['linkmail'] = $_POST['email']; $data2['name'] = $_POST['unit_name']; $data2['linktel'] = $_POST['moblie']; $data2['address'] = $_POST['address']; $data2['linkman'] = $_POST['linkman']; if ($this->config['com_status'] == 0) { $data2['r_status'] = 2; } } if ($_POST['codeid'] == '2' && $this->config['sy_msg_regcode'] == "1") { $Member->UpdateMember(array("moblie" => ''), array("moblie" => trim($_POST['moblie']))); if ($usertype == '1') { $Member->UpdateResume(array("telphone" => "", "moblie_status" => "0"), array("telphone" => $_POST['moblie'])); $data2['moblie_status'] = "1"; } elseif ($usertype == '2') { $Member->UpdateCompany(array("linktel" => "", "moblie_status" => "0"), array("linktel" => $_POST['moblie'])); $data2['moblie_status'] = "1"; } } $Member->InsertReg($table, $data1); $Member->InsertReg($table2, $data2); $Friend = $this->MODEL("friend"); $Friend->SaveFriendInfo(array("uid" => $userid, "nickname" => $_POST['username'], "usertype" => $_POST['usertype'])); if ($_COOKIE['regcode'] != "") { if ($this->config['integral_invite_reg_type'] == "1") { $auto = true; } else { $auto = false; } $Member->company_invtal((int) $_COOKIE['regcode'], $this->config['integral_invite_reg'], $auto, "邀请注册", true, 2, 'integral', 23); } if ($this->config['integral_reg'] > 0) { $Member->company_invtal($userid, $this->config['integral_reg'], true, "注册赠送", true, 2, 'integral', 23); } if ($_POST['usertype'] == "1") { if ($this->config['user_status'] == "1" && $_POST['email']) { $randstr = rand(10000000, 99999999); $base = base64_encode($userid . "|" . $randstr . "|" . $this->config['coding']); $data_cert['uid'] = $userid; $data_cert['type'] = "cert"; $data_cert['email'] = $_POST['email']; $data_cert['url'] = "<a href='" . $this->config['sy_weburl'] . "/index.php?m=qqconnect&c=mcert&id=" . $base . "'>点击认证</a>"; $data_cert['date'] = date("Y-m-d"); if ($this->config['sy_smtpserver'] != "" && $this->config['sy_smtpemail'] != "" && $this->config['sy_smtpuser'] != "") { $this->send_msg_email($data_cert); $this->errjson('帐号激活邮件已发送到您邮箱,请先激活!', 7); } else { $this->errjson('还没有配置邮箱,请联系管理员!'); } } else { $Member->UpdateMember(array("login_date" => time()), array("uid" => $userid)); $this->add_cookie($userid, $_POST['username'], $salt, $_POST['email'], $pass, $usertype); $_POST['uid'] = $userid; $this->regemail($_POST); $this->errjson('', 1); } } elseif ($usertype == "2") { $_POST['uid'] = $userid; $this->regemail($_POST); if ($this->config['com_status'] != "1") { $this->errjson('注册成功,请等待管理员审核!', 7); } else { $Member->UpdateMember(array("login_date" => time()), array("uid" => $userid)); $this->add_cookie($userid, $_POST['username'], $salt, $_POST['email'], $pass, $usertype); $this->errjson('', 1); } } } else { $this->errjson('注册失败!', 8); } } } else { if ($_POST['username'] == '') { $this->errjson('用户名不能为空!', 8); } } }
function index_action() { if ($this->uid || $this->username) { echo "<script>location.href='member/index.php';</script>"; } if ($_POST['submit']) { $usertype = $_POST['usertype'] ? $_POST['usertype'] : 1; $_POST['username'] = yun_iconv('utf-8', 'gbk', $_POST['username']); if (!$this->CheckRegUser($_POST['username']) && !$this->CheckRegEmail($_POST['username'])) { $this->layer_msg('无效的用户名!', 9, 0, ''); } if (!$this->CheckRegEmail($_POST['email'])) { $this->layer_msg('邮箱格式不正确!', 9, 0, ''); } $UserinfoM = $this->MODEL('userinfo'); $member = $UserinfoM->GetMemberOne(array('username' => $_POST['username'], " or `email`='" . $_POST['email'] . "'")); if (is_array($member)) { if ($member['username'] == $_POST['username']) { $this->layer_msg('用户名已存在,请重新输入!', 9, 0, ''); } elseif ($member['email'] == $_POST['email']) { $this->layer_msg('邮箱已存在,请重新输入!', 9, 0, ''); } } else { $regname = @explode(",", $this->config['sy_regname']); if (in_array($_POST['username'], $regname)) { $this->layer_msg('用户名已存在,请重新输入!', 9, 0, ''); } } if ($usertype == '1') { $status = 1; } elseif ($usertype == '2') { $status = $this->config['com_status']; } if ($this->config['sy_uc_type'] == "uc_center") { $this->uc_open(); $uid = uc_user_register($_POST['username'], $_POST['password'], $_POST['email']); if ($uid <= 0) { $this->layer_msg('该用户或邮箱已存在!', 9, 0, ''); } else { list($uid, $username, $password, $email, $salt) = uc_user_login($_POST['username'], $_POST['password']); $pass = md5(md5($_POST['password']) . $salt); $ucsynlogin = uc_user_synlogin($uid); } } elseif ($this->config['sy_pw_type'] == "pw_center") { include APP_PATH . "/api/pw_api/pw_client_class_phpapp.php"; $username = $username; $password = $_POST['password']; $email = $_POST['email']; $pw = new PwClientAPI($username, $password, $email); $pwuid = $pw->register(); $salt = substr(uniqid(rand()), -6); $pass = md5(md5($password) . $salt); } else { $salt = substr(uniqid(rand()), -6); $pass = md5(md5($_POST['password']) . $salt); } $idata = array('username' => $_POST['username'], 'password' => $pass, 'email' => $_POST['email'], 'usertype' => $usertype, 'status' => $status, 'salt' => $salt, 'reg_date' => time(), 'login_date' => time()); $userid = $UserinfoM->AddMember($idata); if ($userid) { if ($_COOKIE['wxid']) { $UserinfoM->UpdateMember(array('wxid' => ''), array('wxid' => $_COOKIE['wxid'])); $UserinfoM->UpdateMember(array('wxid' => $_COOKIE['wxid']), array('uid' => $userid)); setcookie("wxid", '', time() - 86400, "/"); } if ($_COOKIE['unionid']) { $UserinfoM->UpdateMember(array('unionid' => ''), array('unionid' => $_COOKIE['unionid'])); $UserinfoM->UpdateMember(array('unionid' => $_COOKIE['unionid']), array('uid' => $userid)); setcookie("unionid", '', time() - 86400, "/"); } if ($this->config[sy_pw_type] == "pw_center") { $UserinfoM->UpdateMember(array('pwuid' => $pwuid), array('uid' => $userid)); } $UserinfoM->RegisterMember($_POST, array('uid' => $userid, 'usertype' => $usertype)); if ($this->config['integral_reg'] != "") { $UserinfoM->company_invtal($userid, $this->config['integral_reg'], true, "注册", true, 2, 'integral', '26'); } $this->add_cookie($userid, $_POST['username'], $salt, $_POST['email'], $pass, $usertype); $this->layer_msg('恭喜您,已成功注册会员!', 9, 0, 'member/index.php?c=addresume'); } } if ($_GET['usertype'] == "2") { $this->yunset("headertitle", "会员注册"); } else { $this->yunset("headertitle", "会员注册"); } $this->seo("register"); $this->yuntpl(array('mobile/register')); }
function logout($result = true) { if ($this->config['sy_uc_type'] == "uc_center") { $this->obj->uc_open(); echo $logout = uc_user_synlogout(); } elseif ($this->config["sy_pw_type"]) { include APP_PATH . "/api/pw_api/pw_client_class_phpapp.php"; $username = $_SESSION["username"]; $pw = new PwClientAPI($username, "", ""); $logout = $pw->logout(); $this->unset_cookie(); } else { $this->unset_cookie(); } if ($result) { echo 1; die; } }
function index_action() { $this->get_moblie(); if ($this->uid || $this->username) { echo "<script>location.href='member/index.php';</script>"; } if ($_POST['submit']) { if ($_POST['wxid']) { $wxparse = '&wxid=' . $_POST['wxid'] . '&wxname=' . $_POST['wxname']; } if ($_POST['wxname']) { $wxparse = '&wxname=' . $_POST['wxname']; } $usertype = $_POST['usertype'] ? $_POST['usertype'] : 1; if (!$this->CheckRegUser($_POST['username'])) { $this->wapheader('index.php?m=login&', '无效的用户名!'); } if (!$this->CheckRegEmail($_POST['email'])) { $this->wapheader('index.php?m=login&', '邮箱格式不正确!'); } $member = $this->obj->DB_select_once("member", "`username`='" . $_POST['username'] . "' OR `email`='" . $_POST['email'] . "'"); if (is_array($member)) { if ($member['username'] == $_POST['username']) { $this->wapheader('index.php?m=register&usertype=' . $usertype . $wxparse . '&', '用户名已存在,请重新输入!'); } elseif ($member['email'] == $_POST['email']) { $this->wapheader('index.php?m=register&usertype=' . $usertype . $wxparse . '&', '邮箱已存在,请重新输入!'); } } else { $regname = @explode(",", $this->config['sy_regname']); if (in_array($_POST['username'], $regname)) { $this->wapheader('index.php?m=register&usertype=' . $usertype . $wxparse . '&', '用户名已存在,请重新输入!'); } } if ($usertype == '1') { $status = 1; } elseif ($usertype == '2') { $status = $this->config['com_status']; } if ($this->config['sy_uc_type'] == "uc_center") { $this->obj->uc_open(); $uid = uc_user_register($_POST['username'], $_POST['password'], $_POST['email']); if ($uid <= 0) { $this->wapheader('index.php?m=register&usertype=' . $usertype . $wxparse . '&', '该用户或邮箱已存在!'); } else { list($uid, $username, $password, $email, $salt) = uc_user_login($_POST['username'], $_POST['password']); $pass = md5(md5($_POST['password']) . $salt); $ucsynlogin = uc_user_synlogin($uid); } } elseif ($this->config['sy_pw_type'] == "pw_center") { include APP_PATH . "/api/pw_api/pw_client_class_phpapp.php"; $username = $username; $password = $_POST['password']; $email = $_POST['email']; $pw = new PwClientAPI($username, $password, $email); $pwuid = $pw->register(); $salt = substr(uniqid(rand()), -6); $pass = md5(md5($password) . $salt); } else { $salt = substr(uniqid(rand()), -6); $pass = md5(md5($_POST['password']) . $salt); } $idata['username'] = $_POST['username']; $idata['password'] = $pass; $idata['email'] = $_POST['email']; $idata['usertype'] = $usertype; $idata['status'] = $status; $idata['salt'] = $salt; $idata['source'] = '2'; $idata['reg_date'] = $idata['login_date'] = time(); if ($_POST['wxid']) { $this->obj->update_once('member', array('wxid' => '', 'wxname' => ''), array('wxid' => $this->stringfilter($_POST['wxid']))); $idata['wxid'] = $_POST['wxid']; $idata['wxname'] = $this->stringfilter($_POST['wxname']); $idata['wxbindtime'] = time(); } $userid = $this->obj->insert_into('member', $idata); if ($userid) { if ($this->config[sy_pw_type] == "pw_center") { $this->obj->update_once('member', array('pwuid' => $pwuid), array('uid' => $userid)); } if ($usertype == "1") { $table = "member_statis"; $table2 = "resume"; $value = "`uid`='" . $userid . "'"; $udata['uid'] = $userid; $udata2['uid'] = $userid; $udata2['email'] = $_POST['email']; } elseif ($usertype == "2") { $table = "company_statis"; $table2 = "company"; $udata['uid'] = $userid; $udata2['uid'] = $userid; $udata2['linkmail'] = $_POST['email']; $udata2['linkman'] = trim($_POST['linkman']); $udata2['linktel'] = trim($_POST['moblie']); $udata = $this->rating_info($udata); } $this->obj->insert_into($table, $udata); $this->obj->insert_into($table2, $udata2); $this->obj->insert_into('friend_info', array('uid' => $userid, 'nickname' => $_POST['username'], 'usertype' => $usertype)); setcookie("uid", $userid, time() + 86400, "/"); setcookie("username", $_POST['username'], time() + 86400, "/"); setcookie("usertype", $usertype, time() + 86400, "/"); setcookie("salt", $salt, time() + 86400, "/"); setcookie("shell", md5($idata['username'] . $idata['password'] . $idata['salt']), time() + 86400, "/"); $this->wapheader('member/index.php'); } } if ($_GET['usertype'] == "2") { $this->yunset("title", "企业会员注册"); } else { $this->yunset("title", "个人会员注册"); } $this->yuntpl(array('wap/register')); }
function regsave_action() { $_POST = $this->post_trim($_POST); $usertype = intval($_POST['usertype']); $_POST['username'] = $this->stringfilter($_POST['username']); $_POST['unit_name'] = $this->stringfilter($_POST['unit_name']); $_POST['address'] = $this->stringfilter($_POST['address']); $_POST['linkman'] = $this->stringfilter($_POST['linkman']); $_POST['name'] = $this->stringfilter($_POST['name']); if ($_COOKIE['uid'] != "" && $_COOKIE['username'] != "") { $this->errjson('您已经登录了!'); } if (strpos($this->config['code_web'], '注册会员') !== false && md5($_POST['authcode']) != $_SESSION['authcode']) { $this->errjson('验证码错误!'); } if (!$this->CheckRegUser($_POST['username']) && !$this->CheckRegEmail($_POST['username'])) { $this->errjson('用户名包含特殊字符!'); } if ($_POST['codeid'] == '1') { if ($this->config['username'] == '1') { if (!$this->CheckRegUser($_POST['name']) || $_POST['name'] == "") { $this->errjson('真实姓名格式不规范'); } } if ($this->config['usertel'] == '1' && $usertype == '1' || $this->config['linkphone'] == '1' && $usertype == '2') { if (!preg_match("/1[3458]{1}\\d{9}\$/", $_POST['moblie'])) { $this->errjson('手机格式错误!'); } else { $moblieNum = $this->obj->DB_select_num("member", "`moblie`='" . $_POST['moblie'] . "'"); if ($moblieNum > 0) { $this->errjson('手机已存在!'); } } } if ($this->config['useremail'] == '1' && $usertype == '1' || $this->config['comemail'] == '1' && $usertype == '2') { if (!$this->CheckRegEmail($_POST['email']) || $_POST['email'] == "") { $this->errjson('Email格式不规范!'); } } if ($usertype == '2') { if ($this->config['comname'] == '1') { if (!$this->CheckRegUser($_POST['unit_name']) || $_POST['unit_name'] == "") { $arr['status'] = 8; $arr['msg'] = '请正确填写企业名称'; $arr['msg'] = iconv("gbk", "utf-8", $arr['msg']); echo json_encode($arr); die; } } if ($this->config['comaddress'] == '1') { if (!$this->CheckRegUser($_POST['address']) || $_POST['address'] == "") { $arr['status'] = 8; $arr['msg'] = '请正确填写企业地址'; $arr['msg'] = iconv("gbk", "utf-8", $arr['msg']); echo json_encode($arr); die; } } if ($this->config['linkman'] == '1') { if (!$this->CheckRegUser($_POST['linkman']) || $_POST['linkman'] == "") { $this->errjson('请正确填写企业联系人'); } } } } elseif ($_POST['codeid'] == '2') { if (!preg_match("/1[3458]{1}\\d{9}\$/", $_POST['moblie'])) { $this->errjson('手机格式错误!'); } if ($this->config['sy_msg_regcode'] == "1") { if ($_POST['moblie_code']) { $regCertMobile = $this->obj->DB_select_once("company_cert", "`check`='" . $_POST['moblie'] . "'"); } if ($regCertMobile['check2'] != $_POST['moblie_code'] || $regCertMobile['check2'] == '') { $this->errjson('短信验证码错误!'); } } $_POST['username'] = $_POST['moblie']; } elseif ($_POST['codeid'] == '3') { if (!$this->CheckRegEmail($_POST['email']) || $_POST['email'] == "") { $this->errjson('Email格式不规范!'); } $_POST['username'] = $_POST['email']; } if ($_POST['username'] != "" && $arr['status'] == '') { $nid = $this->obj->DB_select_num("member", "`username`='" . $_POST['username'] . "'", "uid"); if ($nid) { $arr['status'] = 8; $arr['msg'] = '账户名已存在!'; } else { if ($_POST['usertype'] == '1') { $satus = 1; } elseif ($_POST['usertype'] == '2') { $satus = $this->config['com_status']; } if ($this->config['sy_uc_type'] == "uc_center") { $this->obj->uc_open(); $uid = uc_user_register($_POST['username'], $_POST['password'], $_POST['email']); if ($uid <= 0) { $arr['status'] = 8; $arr['msg'] = '该邮箱已存在!'; } else { list($uid, $username, $password, $email, $salt) = uc_user_login($_POST['username'], $_POST['password']); $pass = md5(md5($_POST['password']) . $salt); $ucsynlogin = uc_user_synlogin($uid); } } elseif ($this->config['sy_pw_type'] == "pw_center") { include APP_PATH . "/api/pw_api/pw_client_class_phpapp.php"; $username = $username; $password = $_POST['password']; $email = $_POST['email']; $pw = new PwClientAPI($username, $password, $email); $pwuid = $pw->register(); $salt = substr(uniqid(rand()), -6); $pass = md5(md5($password) . $salt); } else { $salt = substr(uniqid(rand()), -6); $pass = md5(md5($_POST['password']) . $salt); } if ($arr['status'] == '') { $ip = $this->obj->fun_ip_get(); $data['username'] = $_POST['username']; $data['password'] = $pass; $data['usertype'] = $_POST['usertype']; $data['email'] = $_POST['email']; $data['moblie'] = $_POST['moblie']; $data['status'] = $satus; $data['salt'] = $salt; $data['reg_date'] = time(); $data['reg_ip'] = $ip; $data['qqid'] = $_SESSION['qq']['openid']; $data['sinaid'] = $_SESSION['sina']['openid']; $data['wxid'] = $_SESSION['wx']['openid']; $data['regcode'] = $_SESSION['regcode']; $userid = $this->obj->insert_into("member", $data); if (!$userid) { $user_id = $this->obj->DB_select_once("member", "`username`='" . $_POST['username'] . "'", "`uid`"); $userid = $user_id['uid']; } if ($userid) { if ($_SESSION['regcode'] != "") { if ($this->config['integral_invite_reg_type'] == "1") { $auto = true; } else { $auto = false; } $this->obj->company_invtal($_SESSION['regcode'], $this->config['integral_invite_reg'], $auto, "邀请注册", true, 2, 'integral', 23); } $this->unset_cookie(); if ($this->config[sy_pw_type] == "pw_center") { $this->obj->DB_update_all("member", "`pwuid`='" . $pwuid . "'", "`uid`='" . $userid . "'"); } if ($_POST['usertype'] == "1") { $table = "member_statis"; $table2 = "resume"; $value = "`uid`='" . $userid . "',`integral`='" . $this->config['integral_score'] . "'"; $value2 = "`uid`='" . $userid . "',`email`='" . $_POST['email'] . "',`telphone`='" . $_POST['moblie'] . "',`name`='" . $_POST['name'] . "'"; } elseif ($_POST['usertype'] == "2") { $table = "company_statis"; $table2 = "company"; $value = "`uid`='" . $userid . "'," . $this->rating_info(); $value2 = "`uid`='" . $userid . "',`linkmail`='" . $_POST['email'] . "',`name`='" . $_POST['unit_name'] . "',`linktel`='" . $_POST['moblie'] . "',`address`='" . $_POST['address'] . "',`linkman`='" . $_POST['linkman'] . "'"; } if ($_POST['codeid'] == '2' && $this->config['sy_msg_regcode'] == "1") { $this->obj->DB_update_all("member", "`moblie`='',", "`moblie`='" . $_POST['moblie'] . "'"); if ($usertype == '1') { $this->obj->DB_update_all("resume", "`telphone`='',`moblie_status`='0'", "`telphone`='" . $_POST['moblie'] . "'"); $value2 .= ",`moblie_status`='1'"; } elseif ($usertype == '2') { $this->obj->DB_update_all("company_statis", "`linktel`='',`moblie_status`='0'", "`linktel`='" . $_POST['moblie'] . "'"); $value .= ",`moblie_status`='1'"; } } $this->obj->DB_insert_once($table, $value); $this->obj->DB_insert_once($table2, $value2); $this->obj->DB_insert_once("friend_info", "`uid`='" . $userid . "',`nickname`='" . $_POST['username'] . "',`usertype`='" . $_POST['usertype'] . "'"); if ($_POST['usertype'] == "1") { if ($this->config['user_status'] == "1") { $randstr = rand(10000000, 99999999); $base = base64_encode($userid . "|" . $randstr . "|" . $this->config['coding']); $data_cert['uid'] = $userid; $data_cert['type'] = "cert"; $data_cert['email'] = $_POST['email']; $data_cert['url'] = "<a href='" . $this->config['sy_weburl'] . "/index.php?m=qqconnect&c=mcert&id=" . $base . "'>点击认证</a>"; $data_cert['date'] = date("Y-m-d"); $this->send_msg_email($data_cert); $arr['status'] = 7; $arr['msg'] = '帐号激活邮件已发送到您邮箱,请先激活!'; } else { $this->obj->DB_update_all("member", "`login_date`='" . time() . "'", "`uid`='" . $userid . "'"); $this->add_cookie($userid, $_POST['username'], $salt, $_POST['email'], $pass, $usertype); $_POST['uid'] = $userid; $this->regemail($_POST); $arr['status'] = 1; } } elseif ($usertype == "2") { $_POST['uid'] = $userid; $this->regemail($_POST); if ($this->config['com_status'] != "1") { $arr['status'] = 7; $arr['msg'] = '注册成功,请等待管理员审核!'; } else { $arr['status'] = 1; $this->obj->DB_update_all("member", "`login_date`='" . time() . "'", "`uid`='" . $userid . "'"); $this->add_cookie($userid, $_POST['username'], $salt, $_POST['email'], $pass, $usertype); } } } else { $arr['status'] = 8; $arr['msg'] = '注册失败!'; } } } } else { if ($_POST['username'] == '' && $arr['status'] == '') { $arr['status'] = 8; $arr['msg'] = '用户名不能为空!'; } } $arr['msg'] = iconv("gbk", "utf-8", $arr['msg']); echo json_encode($arr); die; }
function logout($result = true) { $uiddir = DATA_PATH . "cache/im/"; include $uiddir . "/status.php"; $liststatus = unserialize(base64_decode($statusdata)); if (!empty($liststatus[$this->uid])) { unset($liststatus[$this->uid]); unset($liststatus[$this->uid . "time"]); } $content = base64_encode(serialize($liststatus)); $cont = "<?php"; $cont .= "\r\n"; $cont .= "\$statusdata='" . $content . "';"; $cont .= "?>"; $fp = @fopen($uiddir . "/status.php", "w+"); $filetouid = @fwrite($fp, $cont); @fclose($fp); if ($this->config['sy_uc_type'] == "uc_center") { $this->uc_open(); $logout = uc_user_synlogout(); echo $logout; } elseif ($this->config["sy_pw_type"]) { include APP_PATH . "/api/pw_api/pw_client_class_phpapp.php"; $username = $_SESSION["username"]; $pw = new PwClientAPI($username, "", ""); $logout = $pw->logout(); $this->unset_cookie(); } else { $this->unset_cookie(); } if ($result) { echo 1; die; } }
function loginsave_action() { $username = $this->stringfilter($_POST['username']); if ($_COOKIE['uid'] != "" && $_COOKIE['username'] != "") { $this->ajaxlogin($_POST['comid'], "您已经登陆了,您不是个人用户!"); echo "您已经登录了!"; die; } if ($_POST['path'] != "index") { if (strstr($this->config['code_web'], '前台登陆')) { if (md5($_POST['authcode']) != $_SESSION['authcode']) { unset($_SESSION['authcode']); $this->ajaxlogin($_POST['comid'], "验证码错误!"); echo "验证码错误!"; die; } } } if (!$this->CheckRegUser($username) && !$this->CheckRegEmail($username)) { echo "无效的用户名!"; die; } if ($username != "") { if ($this->config['sy_uc_type'] == "uc_center") { $this->obj->uc_open(); $uname = $username; list($uid, $username, $password, $email) = uc_user_login($username, $_POST['password']); if ($uid < 1) { $user = $this->obj->DB_select_once("member", "`username`='" . $uname . "'", "username,email,uid,password,salt"); $pass = md5(md5($_POST['password']) . $user['salt']); if ($pass == $user['password']) { $uid = $user['uid']; uc_user_register($user['username'], $_POST['password'], $user['email']); list($uid, $username, $password, $email) = uc_user_login($uname, $_POST['password']); } else { echo $msg = '账户或密码错误!'; die; } } else { if ($uid > 0) { $ucsynlogin = uc_user_synlogin($uid); $msg = '登录成功!'; $user = $this->obj->DB_select_once("member", "`username`='" . $username . "'", "`uid`,`usertype`,`email_status`"); if ($_SESSION['qq']['openid']) { $this->obj->DB_update_all("member", "`qqid`='" . $_SESSION['qq']['openid'] . "'", "`username`='" . $username . "'"); unset($_SESSION['qq']); } if ($_SESSION['wx']['openid']) { $this->obj->DB_update_all("member", "`wxid`='" . $_SESSION['wx']['openid'] . "'", "`username`='" . $username . "'"); unset($_SESSION['wx']); } if ($_SESSION['sina']['openid']) { $this->obj->DB_update_all("member", "`sinaid`='" . $_SESSION['wx']['openid'] . "'", "`username`='" . $username . "'"); unset($_SESSION['sina']); } if (!is_array($user)) { $this->unset_cookie(); echo "没有该用户!"; die; } else { echo $ucsynlogin; } if ($this->config['user_status'] == "1") { echo $ucsynlogin; if ($user['email_status'] != "1") { echo "您的账户还未激活,请先激活!"; die; } } if ($_POST['loginname']) { setcookie("loginname", $username, time() + 8640000); } $this->autoupjob($user['uid'], $_POST['usertype']); echo $ucsynlogin; echo 1; die; } elseif ($uid == -1) { $msg = '用户不存在,或者被删除'; } elseif ($uid == -2) { $msg = '密码错误'; } else { $msg = '该用户未定义!'; } } $this->ajaxlogin($_POST['comid'], $msg); echo $msg; die; } else { $user = $this->obj->DB_select_once("member", "`username`='" . $username . "'", "`pw_repeat`,`pwuid`,`uid`,`username`,`salt`,`email`,`password`,`usertype`,`status`,`email_status`"); if ($this->config['sy_pw_type'] == "pw_center") { if ($user['pw_repeat'] != "1") { include APP_PATH . "/api/pw_api/pw_client_class_phpapp.php"; $pw = new PwClientAPI($username, $_POST['password'], ""); $pwuser = $pw->user_login(); if ($pwuser['uid'] > 0) { if (empty($user)) { $user = $this->newuser($pwuser['username'], $pwuser['password'], $pwuser['email'], $user['usertype'], $pwuser['uid'], $qqid); } else { if ($pwuser['uid'] == $user['pwuid']) { $pwrows = $pw->login($pwuser['uid']); $this->add_cookie($user['uid'], $user['username'], $user['salt'], $user['email'], $user['password'], $user['usertype'], $_POST['loginname']); $this->ajaxlogin($_POST['comid'], "1"); $time = strtotime(date("Y-m-d")); $row = $this->obj->DB_select_once("company_pay", "`com_id`='" . $user['uid'] . "' and `pay_time`>'" . $time . "' and `pay_remark`='会员登录'"); if (empty($row)) { $this->get_integral_action($user['uid'], "integral_login", "会员登录"); } echo 1; die; } else { $this->obj->DB_update_all("member", "`pw_repeat`='1'", "`uid`='" . $user['uid'] . "'"); } } } } } if (is_array($user)) { $pass = md5(md5($_POST['password']) . $user['salt']); if ($user['password'] == $pass) { if ($user['status'] == "2") { $this->ajaxlogin($_POST['comid'], "您的账号已被锁定!"); echo "您的账号已被锁定!"; die; } if ($user['usertype'] == "2" && $this->config['com_status'] != "1" && $user['status'] != "1") { $this->ajaxlogin($_POST['comid'], "您还没有通过审核!"); echo "您还没有通过审核!"; die; } if ($this->config['user_status'] == "1" && $user['usertype'] == "1" && $user['email_status'] != "1") { $this->ajaxlogin($_POST['comid'], "您的账户还未激活,请先激活!"); echo "您的账户还未激活,请先激活!"; die; } if ($_SESSION['qq']['openid']) { $this->obj->DB_update_all("member", "`qqid`='" . $_SESSION['qq']['openid'] . "'", "`username`='" . $user['username'] . "'"); unset($_SESSION['qq']); } if ($_SESSION['sinaid']) { $this->obj->DB_update_all("member", "`sinaid`='" . $_SESSION['sinaid'] . "'", "`username`='" . $username . "'"); unset($_SESSION['sinaid']); unset($_SESSION['sinainfo']); } $time = time(); $ip = $this->obj->fun_ip_get(); $this->obj->DB_update_all("member", "`login_ip`='{$ip}',`login_date`='{$time}',`login_hits`=`login_hits`+1", "`uid`='" . $user['uid'] . "'"); $this->unset_cookie(); $this->add_cookie($user['uid'], $user['username'], $user['salt'], $user['email'], $user['password'], $user['usertype'], $_POST['loginname']); $time = strtotime(date("Y-m-d")); $row = $this->obj->DB_select_once("company_pay", "`com_id`='" . $user['uid'] . "' and `pay_time`>'" . $time . "' and `pay_remark`='会员登录'"); if (empty($row)) { $this->get_integral_action($user['uid'], "integral_login", "会员登录"); } if ($qqid) { $this->obj->DB_update_all("member", "`qqid`='{$qqid}'", "`username`='{$username}'"); } $this->ajaxlogin($_POST['comid'], "1"); if ($user['usertype'] == '1') { $resume = $this->obj->DB_select_once("resume", "`uid`='" . $user['uid'] . "'", "`name`,`birthday`"); if ($resume['name'] && $resume['birthday']) { echo 1; die; } else { echo 2; die; } } else { $this->autoupjob($user['uid'], $user['usertype']); echo 1; die; } } else { $this->ajaxlogin($_POST['comid'], "密码不正确!"); echo "密码不正确!"; die; } } else { $this->ajaxlogin($_POST['comid'], "该用户不存在!"); echo "该用户不存在!"; die; } } } else { echo "用户名不能为空!"; die; } }