本文整理汇总了PHP中check_reg_type函数的典型用法代码示例。如果您正苦于以下问题:PHP check_reg_type函数的具体用法?PHP check_reg_type怎么用?PHP check_reg_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_reg_type函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index($page = 1, $issue_id = 0)
{
if (is_login()) {
$this->redirect('Mob/Weibo/index');
} else {
$ph = array();
check_reg_type('username') && ($ph[] = L("username"));
check_reg_type('email') && ($ph[] = L("email"));
check_reg_type('mobile') && ($ph[] = L("phone_number"));
$this->assign('ph', implode('/', $ph));
$this->display();
}
}
示例2: sendVerify
/**
* sendVerify 发送验证码
* @author:xjw129xjt(肖骏涛) xjt@ourstu.com
*/
public function sendVerify()
{
$aAccount = $cUsername = I('post.account', '', 'op_t');
$aType = I('post.type', '', 'op_t');
$aType = $aType == 'mobile' ? 'mobile' : 'email';
$aAction = I('post.action', 'config', 'op_t');
if (!check_reg_type($aType)) {
$str = $aType == 'mobile' ? L('_PHONE_') : L('_EMAIL_');
$this->error($str . L('_ERROR_OPTIONS_CLOSED_') . L('_EXCLAMATION_'));
}
if (empty($aAccount)) {
$this->error(L('_ERROR_ACCOUNT_CANNOT_EMPTY_'));
}
check_username($cUsername, $cEmail, $cMobile);
$time = time();
if ($aType == 'mobile') {
$resend_time = modC('SMS_RESEND', '60', 'USERCONFIG');
if ($time <= session('verify_time') + $resend_time) {
$this->error(L('_ERROR_WAIT_1_') . ($resend_time - ($time - session('verify_time'))) . L('_ERROR_WAIT_2_'));
}
}
if ($aType == 'email' && empty($cEmail)) {
$this->error(L('_ERROR__EMAIL_'));
}
if ($aType == 'mobile' && empty($cMobile)) {
$this->error(L('_ERROR_PHONE_'));
}
$checkIsExist = UCenterMember()->where(array($aType => $aAccount))->find();
if ($checkIsExist) {
$str = $aType == 'mobile' ? L('_PHONE_') : L('_EMAIL_');
$this->error(L('_ERROR_USED_1_') . $str . L('_ERROR_USED_2_') . L('_EXCLAMATION_'));
}
$verify = D('Verify')->addVerify($aAccount, $aType);
if (!$verify) {
$this->error(L('_ERROR_FAIL_SEND_') . L('_EXCLAMATION_'));
}
$res = A(ucfirst($aAction))->doSendVerify($aAccount, $verify, $aType);
if ($res === true) {
if ($aType == 'mobile') {
session('verify_time', $time);
}
$this->success(L('_ERROR_SUCCESS_SEND_'));
} else {
$this->error($res);
}
}
示例3: sendVerify
/**
* sendVerify 发送验证码
* @author:xjw129xjt(肖骏涛) xjt@ourstu.com
*/
public function sendVerify()
{
$aAccount = $cUsername = I('post.account', '', 'op_t');
$aType = I('post.type', '', 'op_t');
$aType = $aType == 'mobile' ? 'mobile' : 'email';
$aAction = I('post.action', 'config', 'op_t');
if (!check_reg_type($aType)) {
$str = $aType == 'mobile' ? '手机' : '邮箱';
$this->error($str . '选项已关闭!');
}
if (empty($aAccount)) {
$this->error('帐号不能为空');
}
check_username($cUsername, $cEmail, $cMobile);
$time = time();
if ($aType == 'mobile') {
$resend_time = modC('SMS_RESEND', '60', 'USERCONFIG');
if ($time <= session('verify_time') + $resend_time) {
$this->error('请' . ($resend_time - ($time - session('verify_time'))) . '秒后再发');
}
}
if ($aType == 'email' && empty($cEmail)) {
$this->error('请验证邮箱格式是否正确');
}
if ($aType == 'mobile' && empty($cMobile)) {
$this->error('请验证手机格式是否正确');
}
$checkIsExist = UCenterMember()->where(array($aType => $aAccount))->find();
if ($checkIsExist) {
$str = $aType == 'mobile' ? '手机' : '邮箱';
$this->error('该' . $str . '已被其他用户使用!');
}
$verify = D('Verify')->addVerify($aAccount, $aType);
if (!$verify) {
$this->error('发送失败!');
}
$res = A(ucfirst($aAction))->doSendVerify($aAccount, $verify, $aType);
if ($res === true) {
if ($aType == 'mobile') {
session('verify_time', $time);
}
$this->success('发送成功,请查收');
} else {
$this->error($res);
}
}
示例4: sendVerify
/**
* sendVerify 发送验证码
* @author:xjw129xjt(肖骏涛) xjt@ourstu.com
*/
public function sendVerify()
{
$aAccount = $cUsername = I('post.account', '', 'op_t');
#=》获取邮件地址或是手机号码
$aType = I('post.type', '', 'op_t');
$aType = $aType == 'mobile' ? 'mobile' : 'email';
#=》获取注册的方式,邮件或是手机
$aAction = I('post.action', 'config', 'op_t');
if (!check_reg_type($aType)) {
$str = $aType == 'mobile' ? '手机' : '邮箱';
$this->error($str . '选项已关闭!');
}
if (empty($aAccount)) {
$this->error('帐号不能为空');
}
check_username($cUsername, $cEmail, $cMobile, $cCompany);
if ($aType == 'email' && empty($cEmail)) {
$this->error('请验证邮箱格式是否正确');
}
if ($aType == 'mobile' && empty($cMobile)) {
$this->error('请验证手机格式是否正确');
}
$checkIsExist = UCenterMember()->where(array($aType => $aAccount))->find();
if ($checkIsExist) {
$str = $aType == 'mobile' ? '手机' : '邮箱';
$this->error('该' . $str . '已被其他用户使用!');
}
#=>添加一条验证记录,并返回产生的随机数
$verify = D('Verify')->addVerify($aAccount, $aType);
if (!$verify) {
$this->error('发送失败!');
}
#=> 实例化当前模块的控制器
$res = A(ucfirst($aAction))->doSendVerify($aAccount, $verify, $aType);
if ($res === true) {
$this->success('发送成功,请查收');
} else {
$this->error($res);
}
}
示例5: saveUsername
/**
* saveUsername 修改用户名
* @author:xjw129xjt(肖骏涛) xjt@ourstu.com
*/
public function saveUsername()
{
$aUsername = $cUsername = I('post.username', '', 'op_t');
if (!check_reg_type('username')) {
$this->error('用户名选项已关闭!');
}
//判断是否登录
if (!is_login()) {
$this->error('请登录后操作!');
}
//判断提交的用户名是否为空
if (empty($aUsername)) {
$this->error('用户名不能为空!');
}
check_username($cUsername, $cEmail, $cMobile);
if (empty($cUsername)) {
!empty($cEmail) && ($str = '邮箱');
!empty($cMobile) && ($str = '手机');
$this->error('用户名不能为' . $str);
}
//验证用户名是否是字母和数字
preg_match("/^[a-zA-Z0-9_]{4,32}\$/", $aUsername, $match);
if (!$match) {
$this->error('用户名只允许英文字母和数字');
}
$uid = get_uid();
$mUcenter = UCenterMember();
//判断用户是否已设置用户名
$username = $mUcenter->where(array('id' => $uid))->getField('username');
if (empty($username)) {
//判断修改的用户名是否已存在
$id = $mUcenter->where(array('username' => $aUsername))->getField('id');
if ($id) {
$this->error('该用户名已经存在!');
} else {
//修改用户名
$rs = $mUcenter->where(array('id' => $uid))->save(array('username' => $aUsername));
if (!$rs) {
$this->error('设置失败!');
}
$this->success('设置成功!', 'refresh');
}
}
$this->error('用户名已经确定不允许修改!');
}
示例6: doLogin
public function doLogin()
{
$aUsername = $username = I('post.username', '', 'op_t');
$aPassword = I('post.password', '', 'op_t');
$aVerify = I('post.verify', '', 'op_t');
$aRemember = I('post.remember', 0, 'intval');
/* 检测验证码 */
if (check_verify_open('login')) {
if (!check_verify($aVerify)) {
$res['info'] = "验证码输入错误。";
return $res;
}
}
/* 调用UC登录接口登录 */
check_username($aUsername, $email, $mobile, $aUnType);
if (!check_reg_type($aUnType)) {
$res['info'] = "该类型未开放登录。";
}
$uid = UCenterMember()->login($username, $aPassword, $aUnType);
if (0 < $uid) {
//UC登录成功
/* 登录用户 */
$Member = D('Member');
$args['uid'] = $uid;
$args = array('uid' => $uid, 'nickname' => $username);
check_and_add($args);
if ($Member->login($uid, $aRemember == 1)) {
//登录用户
//TODO:跳转到登录前页面
if (UC_SYNC && $uid != 1) {
//同步登录到UC
$ref = M('ucenter_user_link')->where(array('uid' => $uid))->find();
$html = '';
$html = uc_user_synlogin($ref['uc_uid']);
}
$oc_config = (include_once './OcApi/oc_config.php');
if ($oc_config['SSO_SWITCH']) {
include_once './OcApi/OCenter/OCenter.php';
$OCApi = new \OCApi();
$html = $OCApi->ocSynLogin($uid);
}
$res['status'] = 1;
$res['info'] = $html;
//$this->success($html, get_nav_url(C('AFTER_LOGIN_JUMP_URL')));
} else {
$res['info'] = $Member->getError();
}
} else {
//登录失败
switch ($uid) {
case -1:
$res['info'] = '用户不存在或被禁用!';
break;
//系统级别禁用
//系统级别禁用
case -2:
$res['info'] = '密码错误!';
break;
default:
$res['info'] = $uid;
break;
// 0-接口参数错误(调试阶段使用)
}
}
return $res;
}
示例7: register
/**
* 注册页
*/
public function register()
{
$this->setMobTitle('注册');
$aRegisteredtype = I('post.registeredtype', '', 'op_t');
switch ($aRegisteredtype) {
case "username":
$aRegType = "username";
$aUsername = $username = I('post.username', '', 'op_t');
break;
case "email":
$aRegType = "email";
$aUsername = $username = I('post.email', '', 'op_t');
break;
case "mobile":
$aRegType = "mobile";
$aUsername = $username = I('post.mobnumber', '', 'op_t');
break;
}
//获取参数
// $aUsername = $username = I('post.username', '', 'op_t');
$aNickname = I('post.nickname', '', 'op_t');
$aPassword = I('post.password', '', 'op_t');
$aVerify = I('post.verify', '', 'op_t');
$aRegVerify = I('post.reg_verify', 0, 'intval');
// $aRegType = I('post.reg_type', '', 'op_t');
$aStep = I('get.step', 'start', 'op_t');
$aRole = I('post.role', 0, 'intval');
//dump($aVerify);
$this->setTopTitle('欢迎注册');
if (!modC('REG_SWITCH', '', 'USERCONFIG')) {
$this->error('注册已关闭');
}
if (IS_POST) {
//注册用户
/* $register_type = modC('REGISTER_TYPE', 'normal', 'Invite');
$register_type = explode(',', $register_type);
if (!in_array('normal', $register_type)) {
$this->ajaxReturn(array('status'=>0,'info'=>"请先输入邀请码,收到邀请的用户才能注册该网站!"));
}*/
$return = check_action_limit('reg', 'ucenter_member', 1, 1, true);
if ($return && !$return['state']) {
$this->error($return['info'], $return['url']);
}
if (strlen($aNickname) <= intval(modC('NICKNAME_MIN_LENGTH', '2', 'USERCONFIG'))) {
$this->error('昵称请不少于' . modC('NICKNAME_MIN_LENGTH', '2', 'USERCONFIG') . '个字符');
}
if (strlen($aNickname) >= modC('NICKNAME_MAX_LENGTH', '32', 'USERCONFIG')) {
$this->error('昵称请不多于' . modC('NICKNAME_MAX_LENGTH', '32', 'USERCONFIG') . '个字符');
}
if (strlen($aUsername) <= modC('USERNAME_MIN_LENGTH', '2', 'USERCONFIG')) {
$this->error('用户名请不少于' . modC('USERNAME_MIN_LENGTH', '2', 'USERCONFIG') . '个字符');
}
if (strlen($aUsername) >= modC('USERNAME_MAX_LENGTH', '32', 'USERCONFIG')) {
$this->error('用户名请不多于' . modC('USERNAME_MAX_LENGTH', '32', 'USERCONFIG') . '个字符');
}
if (empty($aPassword)) {
$this->error('请输入密码');
}
if (strlen($aPassword) < 6 || strlen($aPassword) > 32) {
$this->error('密码长度在6-32位之间');
}
/* 检测验证码 */
if (check_verify_open('reg')) {
// dump(check_verify_open('reg'));
if (!check_verify($aVerify)) {
$this->error('验证码输入错误。');
}
}
if (!$aRole) {
$this->error('请选择角色。');
}
if ($aRegType == 'mobile' && modC('MOBILE_VERIFY_TYPE', 0, 'USERCONFIG') == 1 || modC('EMAIL_VERIFY_TYPE', 0, 'USERCONFIG') == 2 && $aRegType == 'email') {
if (!D('Verify')->checkVerify($aUsername, $aRegType, $aRegVerify, 0)) {
$str = $aRegType == 'mobile' ? '手机' : '邮箱';
$this->error($str . '验证失败');
}
}
$aUnType = 0;
//获取注册类型
check_username($aUsername, $email, $mobile, $aUnType);
if ($aRegType == 'email' && $aUnType != 2) {
$this->error('邮箱格式不正确');
}
if ($aRegType == 'mobile' && $aUnType != 3) {
$this->error('手机格式不正确');
}
if ($aRegType == 'username' && $aUnType != 1) {
$this->error('用户名格式不正确');
}
if (!check_reg_type($aUnType)) {
$this->error('该类型未开放注册。');
}
$aCode = I('post.code', '', 'op_t');
if (!$this->checkInviteCode($aCode)) {
$this->error('非法邀请码!');
}
/* 注册用户 */
//.........这里部分代码省略.........
示例8: register
/**
* register 注册页面
* @author:xjw129xjt(肖骏涛) xjt@ourstu.com
*/
public function register()
{
//获取参数
$aUsername = $username = I('post.username', '', 'op_t');
$aNickname = I('post.nickname', '', 'op_t');
$aPassword = I('post.password', '', 'op_t');
$aVerify = I('post.verify', '', 'op_t');
$aRegVerify = I('post.reg_verify', 0, 'intval');
$aRegType = I('post.reg_type', '', 'op_t');
$aStep = I('get.step', 'start', 'op_t');
$aRole = I('post.role', 0, 'intval');
//$aTuijian = I('post.tuijian',0,'intval');
$aYaoqingma = I('post.yaoqingma', 0, 'intval');
if (!modC('REG_SWITCH', '', 'USERCONFIG')) {
$this->error('注册已关闭');
}
if (IS_POST) {
//注册用户
$return = check_action_limit('reg', 'ucenter_member', 1, 1, true);
if ($return && !$return['state']) {
$this->error($return['info'], $return['url']);
}
/* 检测验证码 */
if (check_verify_open('reg')) {
if (!check_verify($aVerify)) {
$this->error('验证码输入错误。');
}
}
if (!$aRole) {
$this->error('请选择角色。');
}
/* 检测邀请码 */
if ($aYaoqingma) {
$res = D('broker')->checkYaoqingma($aYaoqingma);
if (!$res) {
$this->error('sorry,邀请码不正确');
}
}
//检测短信
if ($aRegType == 'mobile' && modC('MOBILE_VERIFY_TYPE', 0, 'USERCONFIG') == 1 || modC('EMAIL_VERIFY_TYPE', 0, 'USERCONFIG') == 2 && $aRegType == 'email') {
if (!D('Verify')->checkVerify($aUsername, $aRegType, $aRegVerify, 0)) {
$str = $aRegType == 'mobile' ? '手机' : '邮箱';
$this->error($str . '验证失败');
}
}
$aUnType = 0;
//获取注册类型
check_username($aUsername, $email, $mobile, $aUnType);
if ($aRegType == 'email' && $aUnType != 2) {
$this->error('邮箱格式不正确');
}
if ($aRegType == 'mobile' && $aUnType != 3) {
$this->error('手机格式不正确');
}
if ($aRegType == 'username' && $aUnType != 1) {
$this->error('用户名格式不正确');
}
if (!check_reg_type($aUnType)) {
$this->error('该类型未开放注册。');
}
$aCode = I('post.code', '', 'op_t');
if (!$this->checkInviteCode($aCode)) {
$this->error('非法邀请码!');
}
/* 注册用户 */
$uid = UCenterMember()->register($aUsername, $aNickname, $aPassword, $email, $mobile, $aUnType);
if (0 < $uid) {
//注册成功
///////////////////
// 初始化说说 //
///////////////////
$this->initialShuo($uid);
$this->initInviteUser($uid, $aCode, $aRole);
//邀请用户?
$this->initRoleUser($aRole, $uid);
//初始化角色用户
//通常用不上?
if (modC('EMAIL_VERIFY_TYPE', 0, 'USERCONFIG') == 1 && $aUnType == 2) {
set_user_status($uid, 3);
$verify = D('Verify')->addVerify($email, 'email', $uid);
$res = $this->sendActivateEmail($email, $verify, $uid);
//发送激活邮件
// $this->success('注册成功,请登录邮箱进行激活');
}
$uid = UCenterMember()->login($username, $aPassword, $aUnType);
//通过账号密码取到uid
//判断邀请码
if ($aYaoqingma) {
$res = D('broker')->addPid($uid, $aYaoqingma);
}
D('Member')->login($uid, false, $aRole);
//实际登陆
//$this->success('注册成功', U('Ucenter/member/step', array('step' => get_next_step('start'))));
} else {
//注册失败,显示错误信息
$this->error($this->showRegError($uid));
//.........这里部分代码省略.........
示例9: register
/**
* register 注册页面
* @author:xjw129xjt(肖骏涛) xjt@ourstu.com
*/
public function register()
{
//获取参数
$aUsername = $username = I('post.username', '', 'op_t');
$aNickname = I('post.nickname', '', 'op_t');
$aPassword = I('post.password', '', 'op_t');
$aVerify = I('post.verify', '', 'op_t');
$aRegVerify = I('post.reg_verify', '', 'op_t');
$aRegType = I('post.reg_type', '', 'op_t');
$aStep = I('get.step', 'start', 'op_t');
$aRole = I('post.role', 0, 'intval');
if (!modC('REG_SWITCH', '', 'USERCONFIG')) {
$this->error(L('_ERROR_REGISTER_CLOSED_'));
}
if (IS_POST) {
//注册用户
$return = check_action_limit('reg', 'ucenter_member', 1, 1, true);
if ($return && !$return['state']) {
$this->error($return['info'], $return['url']);
}
/* 检测验证码 */
if (check_verify_open('reg')) {
if (!check_verify($aVerify)) {
$this->error(L('_ERROR_VERIFY_CODE_') . L('_PERIOD_'));
}
}
if (!$aRole) {
$this->error(L('_ERROR_ROLE_SELECT_') . L('_PERIOD_'));
}
if ($aRegType == 'mobile' && modC('MOBILE_VERIFY_TYPE', 0, 'USERCONFIG') == 1 || modC('EMAIL_VERIFY_TYPE', 0, 'USERCONFIG') == 2 && $aRegType == 'email') {
if (!D('Verify')->checkVerify($aUsername, $aRegType, $aRegVerify, 0)) {
$str = $aRegType == 'mobile' ? L('_PHONE_') : L('_EMAIL_');
$this->error($str . L('_FAIL_VERIFY_'));
}
}
$aUnType = 0;
//获取注册类型
check_username($aUsername, $email, $mobile, $aUnType);
if ($aRegType == 'email' && $aUnType != 2) {
$this->error(L('_ERROR_EMAIL_FORMAT_'));
}
if ($aRegType == 'mobile' && $aUnType != 3) {
$this->error(L('_ERROR_PHONE_FORMAT_'));
}
if ($aRegType == 'username' && $aUnType != 1) {
$this->error(L('_ERROR_USERNAME_FORMAT_'));
}
if (!check_reg_type($aUnType)) {
$this->error(L('_ERROR_REGISTER_NOT_OPENED_') . L('_PERIOD_'));
}
$aCode = I('post.code', '', 'op_t');
if (!$this->checkInviteCode($aCode)) {
$this->error(L('_ERROR_INV_ILLEGAL_') . L('_EXCLAMATION_'));
}
/* 注册用户 */
$ucenterMemberModel = UCenterMember();
$uid = $ucenterMemberModel->register($aUsername, $aNickname, $aPassword, $email, $mobile, $aUnType);
if (0 < $uid) {
//注册成功
$this->initInviteUser($uid, $aCode, $aRole);
$ucenterMemberModel->initRoleUser($aRole, $uid);
//初始化角色用户
if (modC('EMAIL_VERIFY_TYPE', 0, 'USERCONFIG') == 1 && $aUnType == 2) {
set_user_status($uid, 3);
$verify = D('Verify')->addVerify($email, 'email', $uid);
$res = $this->sendActivateEmail($email, $verify, $uid);
//发送激活邮件
// $this->success('注册成功,请登录邮箱进行激活');
}
$uid = $ucenterMemberModel->login($username, $aPassword, $aUnType);
//通过账号密码取到uid
D('Member')->login($uid, false, $aRole);
//登陆
$this->success('', U('Ucenter/member/step', array('step' => get_next_step('start'))));
} else {
//注册失败,显示错误信息
$this->error($this->showRegError($uid));
}
} else {
//显示注册表单
if (is_login()) {
redirect(U('Home/Index/index'));
}
$this->checkRegisterType();
$aType = I('get.type', '', 'op_t');
$regSwitch = modC('REG_SWITCH', '', 'USERCONFIG');
$regSwitch = explode(',', $regSwitch);
$this->assign('regSwitch', $regSwitch);
$this->assign('step', $aStep);
$this->assign('type', $aType == '' ? 'username' : $aType);
$this->display();
}
}
示例10: register
/**
* register 注册页面
*/
public function register($domain = null)
{
// $domain = return_url();
//获取参数
$aUsername = $username = I('post.username', '', 'op_t');
$aNickname = I('post.nickname', '', 'op_t');
$aPassword = I('post.password', '', 'op_t');
$aVerify = I('post.verify', '', 'op_t');
$aRegVerify = I('post.reg_verify', 0, 'intval');
$aRegType = I('post.reg_type', '', 'op_t');
$aStep = I('get.step', 'start', 'op_t');
$aRole = I('post.role', 0, 'intval');
$acid = I('post.cid', '', 'op_t');
$aCompany = '';
if (!modC('REG_SWITCH', '', 'USERCONFIG')) {
$this->error('注册已关闭');
}
if (IS_POST) {
//注册用户
$return = check_action_limit('reg', 'ucenter_member', 1, 1, true);
if ($return && !$return['state']) {
$this->error($return['info'], $return['url']);
}
/* 检测验证码 */
if (check_verify_open('reg')) {
if (!check_verify($aVerify)) {
$this->error('验证码输入错误。');
}
}
/**
* 手机验证码和邮箱验证码的验证
*/
if ($aRegType == 'mobile' && modC('MOBILE_VERIFY_TYPE', 0, 'USERCONFIG') == 1 || modC('EMAIL_VERIFY_TYPE', 0, 'USERCONFIG') == 2 && $aRegType == 'email') {
if (!D('Verify')->checkVerify($aUsername, $aRegType, $aRegVerify, 0)) {
$str = $aRegType == 'mobile' ? '手机' : '邮箱';
$this->error($str . '验证失败');
}
}
/**
* 根据编号查询集团 // 判断用户IP是否是公司集团IP
*/
if (!empty($acid) && $aRegType == 'company') {
$company = M('Company')->find((int) $acid);
$aCompany = $company['cname'];
$checkIp = new \Expend\CheckIP($company['cip']);
if (TRUE !== $checkIp->check(get_client_ip()) && ip2long(get_client_ip()) !== ip2long($company['cip'])) {
$this->error('你的IP地址不是集团IP');
}
} else {
$acid = 0;
}
$aUnType = 0;
//获取注册类型
check_username($aUsername, $email, $mobile, $aCompany, $aUnType);
if ($aRegType == 'email' && $aUnType != 2) {
$this->error('邮箱格式不正确');
}
if ($aRegType == 'mobile' && $aUnType != 3) {
$this->error('手机格式不正确');
}
if ($aRegType == 'username' && $aUnType != 1) {
$this->error('用户名格式不正确');
}
if (!check_reg_type($aUnType)) {
$this->error('该类型未开放注册。');
}
/* 注册用户 */
$uid = UCenterMember()->register($aUsername, $aNickname, $aPassword, $email, $mobile, $acid, $aUnType, $domain);
if (0 < $uid) {
#初始化角色用户,并设置相关的用户角色信息
$this->initRoleUser($aRole, $uid);
if (modC('EMAIL_VERIFY_TYPE', 0, 'USERCONFIG') == 1 && $aUnType == 2) {
set_user_status($uid, 3);
$verify = D('Verify')->addVerify($email, 'email', $uid);
$res = $this->sendActivateEmail($email, $verify, $uid);
//发送激活邮件
}
$this->success('注册成功', U('Ucenter/member/register', array('mes' => 'login')));
} else {
//注册失败,显示错误信息
$this->error($this->showRegError($uid));
}
} else {
//显示注册表单
if (is_login()) {
redirect(U(C('AFTER_LOGIN_JUMP_URL')));
}
if ($_GET['mes']) {
$this->assign('mes', 'login');
}
//显示集团
$company = D('Admin/Company')->show_company();
$this->assign('company_list', $company);
$this->checkRegisterType();
$aType = I('get.type', '', 'op_t');
$regSwitch = modC('REG_SWITCH', '', 'USERCONFIG');
$regSwitch = explode(',', $regSwitch);
//.........这里部分代码省略.........
示例11: saveUsername
/**
* saveUsername 修改用户名
* @author:xjw129xjt(肖骏涛) xjt@ourstu.com
*/
public function saveUsername()
{
$aUsername = $cUsername = I('post.username', '', 'op_t');
if (!check_reg_type('username')) {
$this->error(L('_ERROR_USERNAME_CONG_CLOSED_') . L('_EXCLAMATION_'));
}
//判断是否登录
if (!is_login()) {
$this->error(L('_ERROR_AFTER_LOGIN_') . L('_EXCLAMATION_'));
}
//判断提交的用户名是否为空
if (empty($aUsername)) {
$this->error(L('_USERNAME_NOT_EMPTY_') . L('_EXCLAMATION_'));
}
check_username($cUsername, $cEmail, $cMobile);
if (empty($cUsername)) {
!empty($cEmail) && ($str = L('_EMAIL_'));
!empty($cMobile) && ($str = L('_PHONE_'));
$this->error(L('_USERNAME_NOT_') . $str);
}
//验证用户名是否是字母和数字
preg_match("/^[a-zA-Z0-9_]{" . modC('USERNAME_MIN_LENGTH', 2, 'USERCONFIG') . "," . modC('USERNAME_MAX_LENGTH', 32, 'USERCONFIG') . "}\$/", $aUsername, $match);
if (!$match) {
$this->error(L('_ERROR_USERNAME_LIMIT_1_') . modC('USERNAME_MIN_LENGTH', 2, 'USERCONFIG') . '-' . modC('USERNAME_MAX_LENGTH', 32, 'USERCONFIG') . L('_ERROR_USERNAME_LIMIT_2_') . L('_EXCLAMATION_'));
}
$uid = get_uid();
$mUcenter = UCenterMember();
//判断用户是否已设置用户名
$username = $mUcenter->where(array('id' => $uid))->getField('username');
if (empty($username)) {
//判断修改的用户名是否已存在
$id = $mUcenter->where(array('username' => $aUsername))->getField('id');
if ($id) {
$this->error(L('_ERROR_USERNAME_EXIST_') . L('_EXCLAMATION_'));
} else {
//修改用户名
$rs = $mUcenter->where(array('id' => $uid))->save(array('username' => $aUsername));
if (!$rs) {
$this->error(L('_FAIL_SETTINGS_') . L('_EXCLAMATION_'));
}
$this->success(L('_SUCCESS_SETTINGS_') . L('_EXCLAMATION_'), 'refresh');
}
}
$this->error(L('_ERROR_USERNAME_CANNOT_MODIFY_') . L('_EXCLAMATION_'));
}
示例12: U
<?php
if (check_reg_type('email')) {
?>
<a href="<?php
echo U('ucenter/member/register', array('type' => 'email'));
?>
"
class="btn btn-block btn-primary btn-lg"><?php
echo L('_REGISTER_EMAIL_');
?>
</a>
<?php
}
?>
<?php
if (check_reg_type('mobile')) {
?>
<a href="<?php
echo U('ucenter/member/register', array('type' => 'mobile'));
?>
"
class="btn btn-block btn-success btn-lg"><?php
echo L('_REGISTER_PHONE_');
?>
</a>
<?php
}
?>
<?php
}
?>
示例13: register
/**
* register 注册页面
* @author:xjw129xjt(肖骏涛) xjt@ourstu.com
*/
public function register()
{
//获取参数
$aUsername = $username = I('post.username', '', 'op_t');
$aNickname = I('post.nickname', '', 'op_t');
$aPassword = I('post.password', '', 'op_t');
$aVerify = I('post.verify', '', 'op_t');
$aRegVerify = I('post.reg_verify', 0, 'intval');
$aRegType = I('post.reg_type', '', 'op_t');
$aStep = I('get.step', 'start', 'op_t');
$aRole = I('post.role', 0, 'intval');
if (!modC('REG_SWITCH', '', 'USERCONFIG')) {
$this->error('注册已关闭');
}
if (IS_POST) {
//注册用户
$return = check_action_limit('reg', 'ucenter_member', 1, 1, true);
if ($return && !$return['state']) {
$this->error($return['info'], $return['url']);
}
/* 检测验证码 */
if (check_verify_open('reg')) {
if (!check_verify($aVerify)) {
$this->error('验证码输入错误。');
}
}
if (!$aRole) {
$this->error('请选择角色。');
}
if ($aRegType == 'mobile' && modC('MOBILE_VERIFY_TYPE', 0, 'USERCONFIG') == 1 || modC('EMAIL_VERIFY_TYPE', 0, 'USERCONFIG') == 2 && $aRegType == 'email') {
if (!D('Verify')->checkVerify($aUsername, $aRegType, $aRegVerify, 0)) {
$str = $aRegType == 'mobile' ? '手机' : '邮箱';
$this->error($str . '验证失败');
}
}
$aUnType = 0;
//获取注册类型
check_username($aUsername, $email, $mobile, $aUnType);
if ($aRegType == 'email' && $aUnType != 2) {
$this->error('邮箱格式不正确');
}
if ($aRegType == 'mobile' && $aUnType != 3) {
$this->error('手机格式不正确');
}
if ($aRegType == 'username' && $aUnType != 1) {
$this->error('用户名格式不正确');
}
if (!check_reg_type($aUnType)) {
$this->error('该类型未开放注册。');
}
/* 注册用户 */
$uid = UCenterMember()->register($aUsername, $aNickname, $aPassword, $email, $mobile, $aUnType);
if (0 < $uid) {
//注册成功
$this->initRoleUser($aRole, $uid);
//初始化角色用户
if (modC('EMAIL_VERIFY_TYPE', 0, 'USERCONFIG') == 1 && $aUnType == 2) {
set_user_status($uid, 3);
$verify = D('Verify')->addVerify($email, 'email', $uid);
$res = $this->sendActivateEmail($email, $verify, $uid);
//发送激活邮件
// $this->success('注册成功,请登录邮箱进行激活');
}
$uid = UCenterMember()->login($username, $aPassword, $aUnType);
//通过账号密码取到uid
D('Member')->login($uid, false, $aRole);
//登陆
$this->success('', U('Ucenter/member/step', array('step' => get_next_step('start'))));
} else {
//注册失败,显示错误信息
$this->error($this->showRegError($uid));
}
} else {
//显示注册表单
if (is_login()) {
$url = C('AFTER_LOGIN_JUMP_URL');
redirect(U($url));
}
//角色
$map['status'] = 1;
$map['invite'] = 0;
$roleList = D('Admin/Role')->selectByMap($map, 'sort asc', 'id,title');
$this->assign('role_list', $roleList);
//角色end
$aType = I('get.type', '', 'op_t');
$regSwitch = modC('REG_SWITCH', '', 'USERCONFIG');
$regSwitch = explode(',', $regSwitch);
$this->assign('regSwitch', $regSwitch);
$this->assign('step', $aStep);
$this->assign('type', $aType == '' ? 'username' : $aType);
$this->display();
}
}
示例14: login
public function login()
{
$aUsername = $username = I('username', '', 'op_t');
$aPassword = I('password', '', 'op_t');
$aVerify = I('verify', '', 'op_t');
$aRemember = I('remember', 0, 'intval');
// 检测验证码
if (check_verify_open('login')) {
if (!check_verify($aVerify)) {
$res['info'] = "验证码输入错误。";
return $res;
}
}
// 调用UC登录接口登录
check_username($aUsername, $email, $mobile, $aUnType);
if (!check_reg_type($aUnType)) {
$res['info'] = "该类型未开放登录。";
}
$uid = UCenterMember()->login($username, $aPassword, $aUnType);
if (0 < $uid) {
//UC登录成功
// 登录用户
$Member = D('Member');
$args['uid'] = $uid;
$args = array('uid' => $uid, 'nickname' => $username);
check_and_add($args);
if ($Member->mobileLogin($uid, $aRemember) == 1) {
//登录用户
if (UC_SYNC && $uid != 1) {
//同步登录到UC
$ref = M('ucenter_user_link')->where(array('uid' => $uid))->find();
}
$extra = array();
$extra['session_id'] = session_id();
$extra['uid'] = $uid;
C(api('Config/lists'));
$extra['weibo_words_limit'] = C('WEIBO_WORDS_COUNT');
$extra['version'] = C('APP_VERSION');
$extra['self'] = query_user(array('uid', 'nickname', 'avatar128', 'avatar256'), is_login());
$this->apiSuccess("登录成功", $extra);
} else {
$this->apiError('登陆成功');
}
} else {
//登录失败
switch ($uid) {
case -1:
$res['info'] = '用户不存在或被禁用!';
break;
//系统级别禁用
//系统级别禁用
case -2:
$res['info'] = '密码错误!';
break;
default:
$res['info'] = $uid;
break;
// 0-接口参数错误(调试阶段使用)
}
}
dump(1111);
$this->apiError($res['info']);
}
示例15: doLogin
public function doLogin()
{
$aUsername = $username = I('post.username', '', 'op_t');
$aPassword = I('post.password', '', 'op_t');
$aVerify = I('post.verify', '', 'op_t');
$aRemember = I('post.remember', 0, 'intval');
/* 检测验证码 */
if (check_verify_open('login')) {
if (!check_verify($aVerify)) {
$res['info'] = L('_INFO_VERIFY_CODE_INPUT_ERROR_') . L('_PERIOD_');
return $res;
}
}
/* 调用UC登录接口登录 */
check_username($aUsername, $email, $mobile, $aUnType);
if (!check_reg_type($aUnType)) {
$res['info'] = L('_INFO_TYPE_NOT_OPENED_') . L('_PERIOD_');
}
$uid = UCenterMember()->login($username, $aPassword, $aUnType);
if (0 < $uid) {
//UC登录成功
/* 登录用户 */
$Member = D('Member');
$args['uid'] = $uid;
$args = array('uid' => $uid, 'nickname' => $username);
check_and_add($args);
if ($Member->login($uid, $aRemember == 1)) {
//登录用户
//TODO:跳转到登录前页面
$html_uc = '';
if (UC_SYNC && $uid != 1) {
include_once './api/uc_client/client.php';
//同步登录到UC
$ref = M('ucenter_user_link')->where(array('uid' => $uid))->find();
$html_uc = uc_user_synlogin($ref['uc_uid']);
}
$oc_config = (include_once './OcApi/oc_config.php');
if ($oc_config['SSO_SWITCH']) {
include_once './OcApi/OCenter/OCenter.php';
$OCApi = new \OCApi();
$html_oc = $OCApi->ocSynLogin($uid);
}
$html = empty($html_oc) ? $html_uc : $html_oc;
$res['status'] = 1;
$res['info'] = $html;
//$this->success($html, get_nav_url(C('AFTER_LOGIN_JUMP_URL')));
} else {
$res['info'] = $Member->getError();
}
} else {
//登录失败
switch ($uid) {
case -1:
$res['info'] = L('_INFO_USER_FORBIDDEN_');
break;
//系统级别禁用
//系统级别禁用
case -2:
$res['info'] = L('_INFO_PW_ERROR_') . L('_EXCLAMATION_');
break;
default:
$res['info'] = $uid;
break;
// 0-接口参数错误(调试阶段使用)
}
}
return $res;
}