当前位置: 首页>>代码示例>>PHP>>正文


PHP UCenterMember函数代码示例

本文整理汇总了PHP中UCenterMember函数的典型用法代码示例。如果您正苦于以下问题:PHP UCenterMember函数的具体用法?PHP UCenterMember怎么用?PHP UCenterMember使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了UCenterMember函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
     }
 }
开发者ID:naliduo,项目名称:Lightweight-social-platform,代码行数:50,代码来源:VerifyController.class.php

示例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' ? '手机' : '邮箱';
         $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);
     }
 }
开发者ID:ccccy,项目名称:wuanlife,代码行数:50,代码来源:VerifyController.class.php

示例3: index

 /**
  * 后台首页
  * @author 麦当苗儿 <zuojiazi@vip.qq.com>
  */
 public function index()
 {
     if (UID) {
         //判断用户是否登陆
         if (IS_POST) {
             /*修改默认的用户统计天数*/
             $count_day = I('post.count_day', C('COUNT_DAY'), 'intval');
             if (M('Config')->where(array('name' => 'COUNT_DAY'))->setField('value', $count_day) === false) {
                 $this->error('设置失败。');
             } else {
                 S('DB_CONFIG_DATA', null);
                 $this->success('设置成功。', 'refresh');
             }
         } else {
             /*首页显示的统计数据*/
             $this->meta_title = '管理首页';
             $today = date('Y-m-d', time());
             $today = strtotime($today);
             $count_day = C('COUNT_DAY');
             $count['count_day'] = $count_day;
             for ($i = $count_day; $i--; $i >= 0) {
                 $day = $today - $i * 86400;
                 $day_after = $today - ($i - 1) * 86400;
                 $week[] = date('m月d日', $day);
                 $user = UCenterMember()->where('status=1 and reg_time >=' . $day . ' and reg_time < ' . $day_after)->count() * 1;
                 $registeredMemeberCount[] = $user;
                 if ($i == 0) {
                     $count['today_user'] = $user;
                 }
             }
             $week = json_encode($week);
             $this->assign('week', $week);
             $count['total_user'] = $userCount = UCenterMember()->where(array('status' => 1))->count();
             $count['today_action_log'] = M('ActionLog')->where('status=1 and create_time>=' . $today)->count();
             $count['last_day']['days'] = $week;
             $count['last_day']['data'] = json_encode($registeredMemeberCount);
             // dump($count);exit;
             $this->assign('count', $count);
             $this->display();
         }
     } else {
         $this->redirect('Public/login');
     }
 }
开发者ID:qimeijun,项目名称:OCenter,代码行数:48,代码来源:IndexController.class.php

示例4: index

 /**
  * 后台首页
  * @author 麦当苗儿 <zuojiazi@vip.qq.com>
  */
 public function index()
 {
     if (UID) {
         if (IS_POST) {
             $count_day = I('post.count_day', C('COUNT_DAY'), 'intval', 7);
             if (M('Config')->where(array('name' => 'COUNT_DAY'))->setField('value', $count_day) === false) {
                 $this->error(L('_ERROR_SETTING_') . L('_PERIOD_'));
             } else {
                 S('DB_CONFIG_DATA', null);
                 $this->success(L('_SUCCESS_SETTING_') . L('_PERIOD_'), 'refresh');
             }
         } else {
             $this->meta_title = L('_INDEX_MANAGE_');
             $today = date('Y-m-d', time());
             $today = strtotime($today);
             $count_day = C('COUNT_DAY', null, 7);
             $count['count_day'] = $count_day;
             for ($i = $count_day; $i--; $i >= 0) {
                 $day = $today - $i * 86400;
                 $day_after = $today - ($i - 1) * 86400;
                 $week_map = array('Mon' => L('_MON_'), 'Tue' => L('_TUES_'), 'Wed' => L('_WEDNES_'), 'Thu' => L('_THURS_'), 'Fri' => L('_FRI_'), 'Sat' => '<strong>' . L('_SATUR_') . '</strong>', 'Sun' => '<strong>' . L('_SUN_') . '</strong>');
                 $week[] = date('m月d日 ', $day) . $week_map[date('D', $day)];
                 $user = UCenterMember()->where('status=1 and reg_time >=' . $day . ' and reg_time < ' . $day_after)->count() * 1;
                 $registeredMemeberCount[] = $user;
                 if ($i == 0) {
                     $count['today_user'] = $user;
                 }
             }
             $week = json_encode($week);
             $this->assign('week', $week);
             $count['total_user'] = $userCount = UCenterMember()->where(array('status' => 1))->count();
             $count['today_action_log'] = M('ActionLog')->where('status=1 and create_time>=' . $today)->count();
             $count['last_day']['days'] = $week;
             $count['last_day']['data'] = json_encode($registeredMemeberCount);
             // dump($count);exit;
             $this->assign('count', $count);
             $this->display();
         }
     } else {
         $this->redirect('Public/login');
     }
 }
开发者ID:naliduo,项目名称:Lightweight-social-platform,代码行数:46,代码来源:IndexController.class.php

示例5: 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);
     }
 }
开发者ID:qimeijun,项目名称:OCenter,代码行数:44,代码来源:VerifyController.class.php

示例6: newAccount

 public function newAccount()
 {
     $aUsername = I('post.username');
     $aNickname = I('post.nickname');
     $aPassword = I('post.password');
     // 行为限制
     $return = check_action_limit('reg', 'ucenter_member', 1, 1, true);
     if ($return && !$return['state']) {
         $this->error($return['info'], $return['url']);
     }
     $ucenterModel = UCenterMember();
     $uid = $ucenterModel->register($aUsername, $aNickname, $aPassword);
     if (0 < $uid) {
         //注册成功
         $this->addSyncLoginData($uid);
         $this->initRoleUser(1, $uid);
         //初始化角色用户
         $uid = $ucenterModel->login($aUsername, $aPassword, 1);
         //通过账号密码取到uid
         $this->doLogin($uid);
         $this->success('绑定成功!', session('login_http_referer'));
     } else {
         //注册失败,显示错误信息
         $this->error(A('Ucenter/Member')->showRegError($uid));
     }
 }
开发者ID:ccccy,项目名称:wuanlife,代码行数:26,代码来源:BaseController.class.php

示例7: unbind

 public function unbind()
 {
     $this->checkIsBind();
     $access_token = session('SYNCLOGIN_ACCESS_TOKEN');
     $openid = session('SYNCLOGIN_OPENID');
     $type = session('SYNCLOGIN_TYPE');
     $token = session('SYNCLOGIN_TOKEN');
     $user_info = D('Addons://SyncLogin/Info')->{$type}($token);
     if ($info1 = D('sync_login')->where("`type_uid`='" . $openid . "' AND type='" . $type . "'")->find()) {
         $user = UCenterMember()->where("id=" . $info1['uid'])->find();
         if (empty($user)) {
             D('sync_login')->where("type_uid=" . $openid . " AND type='" . $type . "'")->delete();
             //已经绑定过,执行登录操作,设置token
         } else {
             if ($info1['oauth_token'] == '') {
                 $syncdata['id'] = $info1['id'];
                 $syncdata['oauth_token'] = $access_token;
                 $syncdata['oauth_token_secret'] = $openid;
                 D('sync_login')->save($syncdata);
             }
             $uid = $info1['uid'];
         }
     } else {
         $Api = new UserApi();
         //usercenter表新增数据
         $uid = $Api->addSyncData();
         //member表新增数据
         D('Home/Member')->addSyncData($uid, $user_info);
         // 记录数据到sync_login表中
         $this->addSyncLoginData($uid, $access_token, $openid, $type, $openid);
         //保存头像
         $this->saveAvatar($user_info['head'], $openid, $uid, $type);
         $config = D('Config')->where(array('name' => 'USER_REG_WEIBO_CONTENT'))->find();
         $reg_weibo = $config['value'];
         //用户注册的微博内容
         if ($reg_weibo != '' && $config) {
             //为空不发微博
             //                D('Weibo/Weibo')->addWeibo($uid, $reg_weibo);
         }
     }
     $this->loginWithoutpwd($uid);
 }
开发者ID:fishling,项目名称:chatPro,代码行数:42,代码来源:BaseController.class.php

示例8: 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;
 }
开发者ID:nanhuacrab,项目名称:jhysns,代码行数:68,代码来源:LoginWidget.class.php

示例9: checkVerify

 /**
  * checkVerify  验证验证码
  * @author:xjw129xjt(肖骏涛) xjt@ourstu.com
  */
 public function checkVerify()
 {
     $aAccount = I('account', '', 'op_t');
     $aType = I('type', '', 'op_t');
     $aVerify = I('verify', '', 'intval');
     $aUid = I('uid', 0, 'intval');
     if (!is_login() || $aUid != is_login()) {
         $this->error('验证失败');
     }
     $aType = $aType == 'mobile' ? 'mobile' : 'email';
     $res = D('Verify')->checkVerify($aAccount, $aType, $aVerify, $aUid);
     if (!$res) {
         $this->error('验证失败');
     }
     UCenterMember()->where(array('id' => $aUid))->save(array($aType => $aAccount));
     $this->success('验证成功', U('ucenter/config/index'));
 }
开发者ID:smartymoon,项目名称:e-anjia,代码行数:21,代码来源:ConfigController.class.php

示例10: 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;
 }
开发者ID:chenyongze,项目名称:bighaha,代码行数:66,代码来源:LoginWidget.class.php

示例11: get_ucuser_uid

function get_ucuser_uid($uid = 0)
{
    $mp_id = get_mpid();
    if ($uid !== NULL) {
        session('uid_' . $mp_id, $uid);
    } elseif (!empty($_REQUEST['uid'])) {
        session('uid_' . $mp_id, $_REQUEST['uid']);
    }
    //以上是带uid参数调用函数时设置session中的uid
    $uid = session('uid_' . $mp_id);
    $isWeixinBrowser = isWeixinBrowser();
    if (!$isWeixinBrowser) {
        //非微信浏览器返回false,调用此函数必须对false结果进行判断,非微信浏览器不可访问调用的controller
        return false;
    }
    //下面这段应该逻辑没问题,如果公众号配置信息错误或者没有snsapi_base作用域的获取信息权限可能会出现死循环,注释掉以下if可治愈
    if ($uid <= 0 && $isWeixinBrowser) {
        $map['openid'] = get_openid();
        $map['mp_id'] = $mp_id;
        $ucuser = D('Ucuser');
        $data = $ucuser->where($map)->find();
        if (!$data) {
            //公众号没有这个粉丝信息,就注册一个
            //先在Member表注册会员,使系统中uid统一,公众号粉丝在绑定手机后可登录网站
            //先在Member表注册会员,使系统中uid统一,公众号粉丝在绑定手机后可登录网站
            $aUsername = $aNickname = $map['openid'];
            //以openid作为默认UcenterMember用户名和Member昵称
            $aPassword = UCenterMember()->create_rand();
            //随机密码,用户未通过公众号注册,就不可登录网站
            $email = $aUsername . '@mp_id' . $map['mp_id'] . '.com';
            //以openid@mpid123.com作为默认邮箱
            $mobile = arr2str(UCenterMember()->rand_mobile());
            //生成随机手机号以通过model校验,不实际使用,准确手机以微信绑定的为准
            $aUnType = 5;
            //微信公众号粉丝注册
            $aRole = 3;
            //默认公众号粉丝用户角色
            /* 注册用户 */
            $uid = UCenterMember()->register($aUsername, $aNickname, $aPassword, $email, $mobile, $aUnType);
            if (0 < $uid) {
                //注册成功
                initRoleUser($aRole, $uid);
                //初始化角色用户
                set_user_status($uid, 1);
                //微信注册的用户状态直接设置为1
            } else {
                //注册失败,显示错误信息
            }
            $uid = $ucuser->registerUser($uid, $map['mp_id'], $map['openid']);
            //用注册member获取的统一uid注册微信粉丝
            session('uid_' . $mp_id, $uid);
        } else {
            $uid = $data['uid'];
            session('uid_' . $mp_id, $uid);
        }
    }
    if (empty($uid)) {
        return -1;
    }
    return $uid;
}
开发者ID:fishling,项目名称:chatPro,代码行数:61,代码来源:weixin.php

示例12: unbind

 protected function unbind($syncData = null)
 {
     //$this->checkIsBind($syncData);
     $access_token = session('SYNCLOGIN_ACCESS_TOKEN');
     $openid = session('SYNCLOGIN_OPENID');
     $type = session('SYNCLOGIN_TYPE');
     $token = session('SYNCLOGIN_TOKEN');
     $user_info = D('Addons://SyncLogin/Info')->{$type}($token);
     $syncData === null && ($syncData = D('sync_login')->where(array('type_uid' => $openid, 'type' => $type))->find());
     if ($syncData) {
         $uid = $syncData['uid'];
         $user = UCenterMember()->where(array('id' => $syncData['uid']))->find();
         if (empty($user)) {
             $this->clearSyncLoginSession();
             //用户已经不存在,删除绑定记录
             D('sync_login')->where(array('type_uid' => $openid, 'type' => $type))->delete();
             return redirect(homeUrl());
         } else {
             //已经绑定过,执行登录操作,设置token
             if (!$syncData['oauth_token'] || $syncData['oauth_token'] != $access_token) {
                 $data = array();
                 $data['id'] = $syncData['id'];
                 $data['oauth_token'] = $access_token;
                 $data['oauth_token_secret'] = $openid;
                 D('sync_login')->save($data);
             }
         }
     } else {
         $Api = new UserApi();
         //usercenter表新增数据
         $uid = $Api->addSyncData();
         //member表新增数据
         D('Common/Member')->addSyncData($uid, $user_info);
         // 记录数据到sync_login表中
         $this->addSyncLoginData($uid, $access_token, $openid, $type, $openid);
         //保存头像
         $this->saveAvatar($user_info['head'], $openid, $uid, $type);
         $config = D('Config')->where(array('name' => 'USER_REG_WEIBO_CONTENT'))->find();
         $reg_weibo = $config['value'];
         //用户注册的微博内容
         if ($reg_weibo != '' && $config) {
             //为空不发微博
             D('Weibo/Weibo')->addWeibo($uid, $reg_weibo);
         }
     }
     $this->loginWithoutpwd($uid);
 }
开发者ID:admpub,项目名称:OpenCenter,代码行数:47,代码来源:BaseController.class.php

示例13: company_dologin

 /**
  * 集团用户登录
  */
 public function company_dologin()
 {
     $aUsername = I('post.username', '', 'op_t');
     $aUnType = 5;
     $aPassword = null;
     if (empty($aUsername)) {
         $res['info'] = '用户名不能为空';
     } else {
         $uid = UCenterMember()->cLogin($aUsername);
         $sessid = UCenterMember()->sessid($aUsername, $aPassword, $aUnType);
         // 登录成功
         if ($uid > 0) {
             $Member = D('Member');
             $args['uid'] = $uid;
             $args = array('uid' => $uid, 'nickname' => $aUsername);
             //判断用户IP和集团IP是否一致
             $user = $Member->where($args)->find();
             if (!empty($user)) {
                 $cmap['id'] = $user['cid'];
                 $company = M('Company')->where($cmap)->find();
                 if (!empty($company)) {
                     $checkIp = new \Expend\CheckIP($company['cip']);
                     //如果客户端IP是集团IP
                     if (TRUE === $checkIp->check(get_client_ip()) || ip2long(get_client_ip()) === ip2long($company['cip'])) {
                         //登录用户
                         if ($Member->login($uid, $aRemember == 1)) {
                             $res['sessid'] = $sessid;
                             $res['status'] = 1;
                         } else {
                             $res['info'] = $Member->getError();
                         }
                     } else {
                         $res['info'] = '用户名与集团IP不匹配';
                     }
                 } else {
                     $res['info'] = '用户名与集团IP不匹配';
                 }
             }
         } else {
             switch ($uid) {
                 case -1:
                     $res['info'] = '用户不存在或被禁用';
                     break;
                 case -3:
                     $res['info'] = '用户不为集团用户';
                     break;
                 default:
                     $res['info'] = $uid;
                     break;
                     // 0-接口参数错误(调试阶段使用)
             }
         }
     }
     return $res;
 }
开发者ID:qimeijun,项目名称:OCenter,代码行数:58,代码来源:LoginWidget.class.php

示例14: addToGroup

 /**
  * 将用户添加到用户组,入参uid,group_id
  * @author 朱亚杰 <zhuyajie@topthink.net>
  */
 public function addToGroup()
 {
     $uid = I('uid');
     $gid = I('group_id');
     if (empty($uid)) {
         $this->error('参数有误');
     }
     $AuthGroup = D('AuthGroup');
     if (is_numeric($uid)) {
         if (is_administrator($uid)) {
             $this->error('该用户为超级管理员');
         }
         if (!M('Member')->where(array('uid' => $uid))->find()) {
             $this->error('管理员用户不存在');
         }
     }
     if ($gid && !$AuthGroup->checkGroupId($gid)) {
         $this->error($AuthGroup->error);
     }
     if ($AuthGroup->addToGroup($uid, $gid)) {
         if ($gid['0'] == 2) {
             $email = UCenterMember()->where(array('id' => $uid))->getField('email');
             $this->sendEmail($email);
         }
         $this->success('操作成功');
     } else {
         $this->error($AuthGroup->getError());
     }
 }
开发者ID:xiaolw,项目名称:wacms,代码行数:33,代码来源:AuthManagerController.class.php

示例15: submitPassword

 /**
  * 修改密码提交
  * @author huajie <banhuajie@163.com>
  */
 public function submitPassword()
 {
     //获取参数
     $password = I('post.old');
     empty($password) && $this->error('请输入原密码');
     $data['password'] = I('post.password');
     empty($data['password']) && $this->error('请输入新密码');
     $repassword = I('post.repassword');
     empty($repassword) && $this->error('请输入确认密码');
     if ($data['password'] !== $repassword) {
         $this->error('您输入的新密码与确认密码不一致');
     }
     $Api = new UserApi();
     $res = $Api->updateInfo(UID, $password, $data);
     if ($res['status']) {
         $this->success('修改密码成功!');
     } else {
         $this->error(UCenterMember()->getErrorMessage($res['info']));
     }
 }
开发者ID:ccccy,项目名称:wuanlife,代码行数:24,代码来源:UserController.class.php


注:本文中的UCenterMember函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。