本文整理匯總了PHP中UserUtils::checkMobileCode方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserUtils::checkMobileCode方法的具體用法?PHP UserUtils::checkMobileCode怎麽用?PHP UserUtils::checkMobileCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserUtils
的用法示例。
在下文中一共展示了UserUtils::checkMobileCode方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _register
private function _register($res, $username, $password, $email, $mobile, $code, $isValidation)
{
if ($isValidation) {
// 是否開啟注冊手機驗證
$isRegisterValidation = WebUtils::getDzPluginAppbymeAppConfig('mobcent_register_validation');
if ($isRegisterValidation) {
$checkInfo = UserUtils::checkMobileCode($res, $mobile, $code);
if ($checkInfo['rs'] == 0) {
return $this->makeErrorInfo($res, $checkInfo['errcode']);
}
}
}
$regInfo = UserUtils::register($username, $password, $email);
if ($regInfo['errcode']) {
return $this->makeErrorInfo($res, $regInfo['message']);
}
if ($isValidation) {
if ($isRegisterValidation) {
// 注冊完畢之後更新手機驗證信息
$updataArr = array('uid' => $regInfo['info']['uid']);
AppbymeSendsms::updateMobile($mobile, $updataArr);
}
}
$userInfo = AppbymeUserAccess::registerProcess($regInfo['info']['uid'], $password);
$res['token'] = (string) $userInfo['token'];
$res['secret'] = (string) $userInfo['secret'];
$res['uid'] = (int) $regInfo['info']['uid'];
return $res;
}
示例2: _checkMobileCode
private function _checkMobileCode($res, $mobile, $code)
{
$checkInfo = UserUtils::checkMobileCode($res, $mobile, $code);
if ($checkInfo['rs'] == 0) {
return $this->makeErrorInfo($res, $checkInfo['errcode']);
}
return $res;
}
示例3: _login
private function _login($res, $username, $password, $mobile, $code, $isValidation)
{
global $_G;
$username = rawurldecode($username);
$password = rawurldecode($password);
if ($username == MOBCENT_HACKER_USER && $password == MOBCENT_HACKER_PASSWORD) {
$token = isset($_GET['accessToken']) ? $_GET['accessToken'] : '';
$secret = isset($_GET['accessSecret']) ? $_GET['accessSecret'] : '';
$uid = $_G['uid'] = AppbymeUserAccess::getUserIdByAccess($token, $secret);
// 客戶端傳的登錄狀態失效
if (!$uid) {
return $this->makeErrorInfo($res, 'mobcent_login_status');
}
$result['member'] = getuserbyuid($uid);
$_G['username'] = $result['member']['username'];
// 把登錄信息寫入cookie中,並且更新登錄的狀態
UserUtils::updateCookie($result['member'], $uid);
// 需要整理token和secret再返回給客戶端
$userInfo = array('token' => $token, 'secret' => $secret);
} else {
$username = WebUtils::t($username);
$logInfo = UserUtils::login($username, $password);
if ($logInfo['errcode']) {
UserUtils::delUserAccessByUsername($username);
return $this->makeErrorInfo($res, $logInfo['message']);
}
if ($isValidation == 1) {
// 是否開啟了登錄手機驗證
$isLoginValidation = WebUtils::getDzPluginAppbymeAppConfig('mobcent_login_validation');
if ($isLoginValidation) {
$userMobileBind = AppbymeSendsms::getBindInfoByUid($_G['uid']);
if (!$userMobileBind) {
// 當前登錄的用戶沒有綁定手機號碼
if ($mobile == '' && $code == '') {
$res['isValidation'] = 1;
return $this->makeErrorInfo($res, '', array('noError' => 0, 'alert' => 0));
}
$checkInfo = UserUtils::checkMobileCode($res, $mobile, $code);
if ($checkInfo['rs'] == 0) {
return $this->makeErrorInfo($res, $checkInfo['errcode']);
}
$updataArr = array('uid' => $_G['uid']);
AppbymeSendsms::updateMobile($mobile, $updataArr);
}
}
}
$userInfo = AppbymeUserAccess::loginProcess($_G['uid'], $password);
}
$userAvatar = UserUtils::getUserAvatar($_G['uid']);
$res['isValidation'] = 0;
$res['token'] = (string) $userInfo['token'];
$res['secret'] = (string) $userInfo['secret'];
$res['uid'] = (int) $_G['uid'];
$res['avatar'] = (string) $userAvatar;
$res['userName'] = (string) $_G['username'];
return $res;
}