本文整理汇总了PHP中getuserbyuid函数的典型用法代码示例。如果您正苦于以下问题:PHP getuserbyuid函数的具体用法?PHP getuserbyuid怎么用?PHP getuserbyuid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getuserbyuid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scan
public static function scan($param)
{
list($data) = $param;
self::_init();
global $_G;
if (!$_G['wechat']['setting']['wsq_allow']) {
return;
}
$authcode = C::t('#wechat#mobile_wechat_authcode')->fetch_by_code($data['key']);
if (!$authcode || $authcode['status']) {
// echo WeChatServer::getXml4Txt(lang('plugin/wechat', 'wechat_response_text_codeerror'));
} else {
if ($authcode['uid']) {
$member = getuserbyuid($authcode['uid'], 1);
if ($member['adminid'] == 0 && !$_G['wechat']['setting']['wechat_confirmtype']) {
C::t('#wechat#mobile_wechat_authcode')->update($authcode['sid'], array('uid' => $member['uid'], 'status' => 1));
$authcode['sid'] = '';
}
} else {
$wechatuser = C::t('#wechat#common_member_wechat')->fetch_by_openid($data['from']);
if ($wechatuser) {
$member = getuserbyuid($wechatuser['uid'], 1);
if ($member['adminid'] == 0 && !$_G['wechat']['setting']['wechat_confirmtype']) {
C::t('#wechat#mobile_wechat_authcode')->update($authcode['sid'], array('uid' => $member['uid'], 'status' => 1));
$authcode['sid'] = '';
}
} elseif ($_G['wechat']['setting']['wechat_allowregister'] && $_G['wechat']['setting']['wechat_allowfastregister'] && $_G['wechat']['setting']['wechat_mtype'] == 2) {
require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.class.php';
require_once libfile('function/member');
$uid = WeChat::register(WeChat::getnewname($data['from']), 1);
if ($uid) {
WeChatHook::bindOpenId($uid, $data['from'], 1);
C::t('#wechat#mobile_wechat_authcode')->update($authcode['sid'], array('uid' => $uid, 'status' => 1));
}
wsq::report('register');
$authcode['sid'] = '';
}
}
wsq::report('scanqr');
self::_show('scan', $data['from'] . "\t" . $authcode['sid']);
}
}
示例2: user_login
function user_login($uid)
{
$member = getuserbyuid($uid);
$cookietime = 1296000;
require_once libfile('function/member');
setloginstatus($member, $cookietime);
}
示例3: poll_upload
function poll_upload()
{
global $_G;
$this->uid = intval($_G['gp_uid']);
$swfhash = md5(substr(md5($_G['config']['security']['authkey']), 8) . $this->uid);
if (!$_FILES['Filedata']['error'] && $_G['gp_hash'] == $swfhash && $this->uid) {
$this->aid = 0;
$this->simple = 0;
$this->user = getuserbyuid($this->uid);
if (empty($this->user['adminid'])) {
$this->uploadmsg(9);
}
$_G['uid'] = $this->uid;
$this->pollid = !empty($_G['gp_pollid']) ? intval($_G['gp_pollid']) : 0;
if ($this->pollid <= 0 || !intval(DB::result_first("SELECT contenttype FROM " . DB::table('poll_item') . " WHERE itemid='{$this->pollid}'"))) {
$this->uploadmsg(9);
}
$attach = upload_images($_FILES['Filedata'], 'poll', 176, 176);
$caption = dhtmlspecialchars(trim($attach['name']));
$caption = substr($caption, 0, -(strlen(fileext($caption)) + 1));
$data = array('itemid' => $this->pollid, 'caption' => $caption, 'displayorder' => 0, 'imageurl' => $attach['attachment'], 'aid' => $attach['aid']);
DB::insert('poll_choice', $data);
$this->aid = $this->pollid;
$this->uploadmsg(0);
}
}
示例4: getinvite
function getinvite()
{
global $_G;
$result = array();
$cookies = empty($_G['cookie']['invite_auth']) ? array() : explode(',', $_G['cookie']['invite_auth']);
$cookiecount = count($cookies);
if ($cookiecount == 2) {
$id = intval($cookies[0]);
$code = $cookies[1];
$query = DB::query("SELECT * FROM " . DB::table('common_invite') . " WHERE id='{$id}'");
if ($invite = DB::fetch($query)) {
if ($invite['code'] == $code && empty($invite['fuid']) && (empty($invite['endtime']) || $_G['timestamp'] < $invite['endtime'])) {
$result['uid'] = $invite['uid'];
$result['id'] = $invite['id'];
$result['appid'] = $invite['appid'];
}
}
} elseif ($cookiecount == 3) {
$uid = intval($cookies[0]);
$code = $cookies[1];
$appid = intval($cookies[2]);
$invite_code = space_key($uid, $appid);
if ($code == $invite_code) {
$result['uid'] = $uid;
$result['appid'] = $appid;
}
}
if ($result['uid']) {
$member = getuserbyuid($result['uid']);
$result['username'] = $member['username'];
} else {
dsetcookie('invite_auth', '', -86400 * 365);
}
return $result;
}
示例5: _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;
}
示例6: synlogin
public static function synlogin($get, $post)
{
global $_G;
header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
$cookietime = 31536000;
$user_id = intval($get['user_id']);
if ($member = getuserbyuid($user_id)) {
self::dsetcookie('auth', self::authcode("{$member['password']}\t{$member['user_id']}", 'ENCODE'), $cookietime);
}
}
示例7: update_groupid_by_uid
public function update_groupid_by_uid($uid)
{
$user = getuserbyuid($uid);
if ($user['groupid'] == 1) {
return;
}
if (DB::result_first("select COUNT(*) from %t where uid=%d", array($this->_table, $uid))) {
$groupid = 2;
} else {
$groupid = 9;
}
return C::t('user')->update($uid, array('groupid' => $groupid));
}
示例8: onUsersGetFormHash
public function onUsersGetFormHash($uId, $userAgent)
{
global $_G;
$uId = intval($uId);
if (!$uId) {
return false;
}
$member = getuserbyuid($uId, 1);
$_G['username'] = $member['username'];
$_G['uid'] = $member['uid'];
$_G['authkey'] = md5($_G['config']['security']['authkey'] . $userAgent);
return formhash();
}
示例9: fetch_perm_by_uid
public function fetch_perm_by_uid($uid, $cid)
{
$user = getuserbyuid($uid);
if ($user['adminid'] == 1) {
return 3;
}
if (DB::result_first("select COUNT(*) from %t where cid=%d and uid=%d", array($this->_table, $cid, $uid))) {
return DB::result_first("select `perm` from %t where cid=%d and uid=%d", array($this->_table, $cid, $uid));
} else {
return 0;
}
return DB::result_first("select perm from %t where cid=%d and uid=%d", array($this->_table, $cid, $uid));
}
示例10: _inviteActiv
private function _inviteActiv($res, $accessToken, $accessSecret, $device, $activityId)
{
// 获取邀请注册活动的配置
$config = ActivityUtils::getInviteConfig($activityId);
if (empty($config) || !$config['is_run']) {
return $this->makeErrorInfo($res, 'mobcent_activity_invalid');
}
$res['body']['sponsor'] = (string) $config['sponsor'];
$res['body']['startTime'] = (string) $config['start_time'] . '000';
$res['body']['stopTime'] = (string) $config['stop_time'] . '000';
$res['body']['firstReward'] = (int) $config['first_reward'];
$res['body']['inviteReward'] = (int) $config['invite_reward'];
$res['body']['isShowCheck'] = 0;
$res['body']['exchangeNum'] = '';
$res['body']['activityRule'] = (string) $config['activity_rule'];
$res['body']['shareAppUrl'] = (string) $config['share_appurl'];
if ($accessToken !== '' && $accessSecret !== '') {
$uid = AppbymeUserAccess::getUserIdByAccess($accessToken, $accessSecret);
if ($uid) {
// 当前登录用户参加活动信息|appbyme_activity_invite_user
$exchangeInfo = AppbymeActivityInviteUser::getExchangeInfo($uid);
if ($exchangeInfo) {
$checkInvite = ActivityUtils::checkInvite($config, $uid, $device);
if ($checkInvite['rs']) {
$res['body']['isShowCheck'] = 1;
}
$res['body']['exchangeNum'] = $exchangeInfo['exchange_num'];
} else {
$checkInvite = ActivityUtils::checkInvite($config, $uid, $device);
$userInfo = getuserbyuid($uid);
$username = $userInfo['username'];
$rewardSum = $config['first_reward'];
$availableReward = $config['first_reward'];
$exchangeNum = $this->getUniqueNum($uid);
$joining = 0;
if (empty($checkInvite['rs'])) {
$joining = 1;
}
$insertUser = array('uid' => $uid, 'activity_id' => $activityId, 'username' => $username, 'reward_sum' => $rewardSum, 'available_reward' => $availableReward, 'exchange_num' => $exchangeNum, 'device' => $device, 'joining' => $joining);
if (AppbymeActivityInviteUser::insertUser($insertUser)) {
if ($checkInvite['rs']) {
$res['body']['isShowCheck'] = 1;
}
$res['body']['exchangeNum'] = (string) $exchangeNum;
}
}
}
}
return $res;
}
示例11: sendpm
public static function sendpm($toid, $subject, $message, $fromid = '', $replypmid = 0, $isusername = 0, $type = 0)
{
global $_G;
if ($fromid === '') {
$fromid = $_G['uid'];
}
$author = '';
if ($fromid) {
if ($fromid == $_G['uid']) {
$sendpmmaxnum = $_G['group']['allowsendpmmaxnum'];
$author = $_G['username'];
} else {
$user = getuserbyuid($fromid);
$author = $user['username'];
loadcache('usergroup_' . $user['groupid']);
$sendpmmaxnum = $_G['cache']['usergroup_' . $user['groupid']]['allowsendpmmaxnum'];
}
$currentnum = C::t('common_member_action_log')->count_day_hours(getuseraction('pmid'), $fromid);
if ($sendpmmaxnum && $currentnum >= $sendpmmaxnum) {
return -16;
}
}
loaducenter();
$return = uc_pm_send($fromid, $toid, addslashes($subject), addslashes($message), 1, $replypmid, $isusername, $type);
if ($return > 0 && $fromid) {
if ($_G['setting']['cloud_status']) {
$msgService = Cloud::loadClass('Cloud_Service_Client_Message');
if (is_numeric($toid)) {
$tospace = getuserbyuid($toid);
if ($tospace['conisbind']) {
$msgService->add($toid, $fromid, $author, $_G['timestamp']);
}
} else {
$senduids = array();
foreach (C::t('common_member')->fetch_all_by_username(explode(',', $toid)) as $touser) {
if ($touser['conisbind']) {
$senduids[$touser['uid']] = $touser['uid'];
}
}
if ($senduids) {
$msgService->add($senduids, $fromid, $author, $_G['timestamp']);
}
}
}
foreach (explode(',', $fromid) as $v) {
useractionlog($fromid, 'pmid');
}
}
return $return;
}
示例12: connect_login
function connect_login($connect_member)
{
global $_G;
if (!($member = getuserbyuid($connect_member['uid'], 1))) {
return false;
} else {
if (isset($member['_inarchive'])) {
C::t('common_member_archive')->move_to_master($member['uid']);
}
}
require_once libfile('function/member');
$cookietime = 1296000;
setloginstatus($member, $cookietime);
dsetcookie('connect_login', 1, $cookietime);
dsetcookie('connect_is_bind', '1', 31536000);
dsetcookie('connect_uin', $connect_member['conopenid'], 31536000);
return true;
}
示例13: setAdministror
public function setAdministror($uid, $adminid)
{
$user = getuserbyuid($uid);
if ($user['adminid'] == $adminid) {
return true;
}
if (self::checkfounder($user)) {
//创始人不允许修改
return true;
}
$arr = array();
if ($adminid > 0) {
parent::update($uid, array('adminid' => 1, 'groupid' => 1));
} else {
$groupid = 9;
if (C::t('organization_admin')->fetch_orgids_by_uid($uid)) {
$groupid = 2;
}
parent::update($uid, array('adminid' => 0, 'groupid' => $groupid));
}
}
示例14: notification_add
public static function notification_add($touid, $type, $note, $notevars = array(), $category = 0, $langfolder)
{
global $_G;
if (!($tospace = getuserbyuid($touid))) {
return false;
}
$notestring = lang('notification', $note, $notevars, '', $langfolder);
$notestring_wx = lang('notification', $note . '_wx', $notevars, '', $langfolder);
$redirect = lang('notification', $note . '_redirecturl', $notevars, '', $langfolder);
$title = lang('notification', $note . '_title', $notevars, '', $langfolder);
$oldnote = array();
//if($notevars['from_id'] && $notevars['from_idtype']) {
$oldnote = C::t('notification')->fetch_by_fromid_uid_type($notevars['from_id'], $notevars['from_idtype'], $touid, $type);
//}
if (empty($oldnote['from_num'])) {
$oldnote['from_num'] = 0;
}
$notevars['from_num'] = $notevars['from_num'] ? $notevars['from_num'] : 1;
$setarr = array('uid' => $touid, 'type' => $type, 'new' => 1, 'wx_new' => 1, 'wx_note' => $notestring_wx, 'redirecturl' => $redirect, 'title' => $title, 'authorid' => $_G['uid'], 'author' => $_G['username'], 'note' => $notestring, 'dateline' => $_G['timestamp'], 'from_id' => $notevars['from_id'], 'from_idtype' => $notevars['from_idtype'], 'from_num' => $oldnote['from_num'] + $notevars['from_num'], 'category' => $category);
if ($category == 1) {
$setarr['authorid'] = 0;
$setarr['author'] = '';
}
if ($oldnote['id']) {
$setarr['id'] = $oldnote['id'];
C::t('notification')->update($oldnote['id'], $setarr);
} else {
$oldnote['new'] = 0;
$setarr['id'] = C::t('notification')->insert($setarr, true);
}
//self::wx_notification($setarr);
//$banType = array('task');
if (empty($oldnote['new'])) {
C::t('user')->increase($touid, array('newprompt' => 1));
/*require_once libfile('function/mail');
$mail_subject = lang('notification', 'mail_to_user');
sendmail_touser($touid, $mail_subject, $notestring, $type);*/
}
}
示例15: _login
private function _login($res, $username, $password)
{
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']);
}
$userInfo = AppbymeUserAccess::loginProcess($_G['uid'], $password);
}
$userAvatar = UserUtils::getUserAvatar($_G['uid']);
$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;
}