本文整理汇总了PHP中QC::get_user_info方法的典型用法代码示例。如果您正苦于以下问题:PHP QC::get_user_info方法的具体用法?PHP QC::get_user_info怎么用?PHP QC::get_user_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QC
的用法示例。
在下文中一共展示了QC::get_user_info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: callback
/**
* 返回登录
*/
public function callback()
{
require_once COMMON_LIB_PATH . "QqConnect/API/qqConnectAPI.php";
$qc = new QC();
$callback = $qc->qq_callback();
$openid = $qc->get_openid();
$user = K("user")->field("uid,username,password,qqau,userlock,uuid,usergroup")->where(array("qqau" => $openid))->find();
session("qqau", $openid);
if (empty($user["qqau"])) {
//首次登录或没有绑定账号
$qc = new QC($callback, $openid);
$arr = $qc->get_user_info();
session("UserInfo", $arr["nickname"]);
go("Passport/Qqlogin/index");
} elseif ($user["qqau"] == $openid) {
//数据库比对正确
if ($user["userlock"] == 1) {
$this->error("您已经被锁定,请联系管理员!");
}
//$this->eve_exp($user["uid"]);
$loginData = array("logintime" => time(), "loginip" => ip::getClientIp(), "qqau" => $openid);
M("user")->where(array("uid" => $user["uid"]))->save($loginData);
// p($_POST);
session("username", $user["username"]);
session("uid", $user["uid"]);
session("uuid", $user["uuid"]);
session("usergroup", $user["usergroup"]);
$this->success("登录成功!正在跳转...", U(__WEB__));
}
}
示例2: callback
public function callback()
{
require 'QQ/API/qqConnectAPI.php';
//引进qqapi 接口
$qc = new \QC();
$acs = $qc->qq_callback();
//获取access-token 和openid
$oid = $qc->get_openid();
$qc = new \QC($acs, $oid);
$uinfo = $qc->get_user_info();
//获取用户信息
$user = M('user');
$list = $user->where("openid='" . $oid . "' and status = 1")->find();
if ($list) {
session('userid', $list['id']);
session('username', $list['nickname']);
session('userphone', $list['mobile']);
session('userimg', $list['headpic']);
//var_dump($list);die();
echo "<script>window.close();window.opener.location.reload()</script>";
exit;
//$this->redirect('Index/index', '', 0, '页面跳转中...');
} else {
session('openid', $oid);
session('uinfo', $uinfo);
session('sign', array('name' => 'QQ账号', 'code' => 1));
echo "<script>window.close();window.opener.location.href='" . U('User/threepartlogin') . "'</script>";
exit;
}
}
示例3: qqcallback
public function qqcallback()
{
Vendor('Oauth.QC#class');
$qc = new \QC();
$token = $qc->qq_callback();
$openid = $qc->get_openid();
if (!$token || !$openid) {
$this->error('操作失败');
}
// 重新实例化 QC类
$qc = new \QC($token, $openid);
$uinfo = $qc->get_user_info();
$this->user_model = D('user');
$user = $this->user_model->field('id,email,password')->where(array('qq_token' => $token, 'qq_openid' => $openid))->find();
// echo $this->user_model->getLastSql();
if ($user['id'] > 0) {
// 登录用户
if ($this->user_model->login($user['id'], $user['email'], $user['password'])) {
//TODO:跳转到登录前页面
$this->success('登录成功!', session('rebackurl'));
} else {
$this->error($model->getError());
}
} else {
session('avatar', $uinfo['figureurl_qq_2']);
session('openid', $openid);
session('token', $token);
session('uname', $uinfo['nickname']);
session('oatype', 'qq_');
//print_r($uinfo);
$this->redirect('join');
}
}
示例4: callback
public function callback()
{
vendor('QQApi.qqConnectAPI');
$qc = new \QC();
$access_token = $qc->qq_callback();
$openid = $qc->get_openid();
$data['data'] = serialize(array('access_token' => $access_token, 'openid' => $openid));
M('post_log')->add($data);
//注册会员信息
//查看此openid是否存在
$map['username'] = $openid;
$detail = D('User')->where($map)->find();
$userid = $detail['userid'];
$nickname = $detail['nickname'];
if (!$detail) {
//获取用户信息
$arr = $qc->get_user_info();
M('post_log')->add(array('data' => serialize($arr)));
$info['username'] = $openid;
$info['nickname'] = $nickname = $arr['nickname'];
$userid = D('User')->add($info);
}
if ($userid) {
//保存session
session('userid', $userid);
//保存cookie用户信息
cookie('userid', $userid);
cookie('nickname', $nickname);
cookie('userid', $userid);
redirect(U('Shenma/user'));
}
/* $arr = $qc->get_user_info();
var_dump($arr);exit; */
}
示例5: getUserInfo
public function getUserInfo()
{
require_once dirname(__FILE__) . "/API/qqConnectAPI.php";
$qc = new QC(ISession::get('access_token'), ISession::get('openid'), $this->apiId);
$arr = $qc->get_user_info();
$userInfo['id'] = ISession::get('openid');
$userInfo['name'] = isset($arr['nickname']) ? $arr['nickname'] : '';
return $userInfo;
}
示例6: qq_callback
public function qq_callback()
{
require_once "./public/Library/qqAuth/qqConnectAPI.php";
$qc = new QC();
//echo $qc->qq_callback();
$openid = $qc->get_openid();
$arr = $qc->get_user_info();
$nickname = $arr["nickname"];
//TODO 注册登录操作
}
示例7: actionQq_callback
/**
* QQ回调地址
*
*/
public function actionQq_callback()
{
require_once Yii::getPathOfAlias('ext') . "/OAuth/qq/qqConnectAPI.php";
$qc = new QC();
$access_token = $qc->qq_callback();
$openid = $qc->get_openid();
$qc = new QC($access_token, $openid);
$user_info = $qc->get_user_info();
//查看是否已绑定
$bind = OAuthQQ::model()->findByPk($openid);
//数据
$data = array('type' => 'qq', 'access_token' => $access_token, 'openid' => $openid, 'uid' => $bind ? $bind->uid : 0, 'username' => $user_info['nickname'], 'avatar' => $user_info['figureurl_2']);
//绑定注册
$this->bind_register($bind, $data);
}
示例8: getUserInfo
/**
* 获得用户信息
* 具体接口:http://wiki.open.qq.com/wiki/website/get_user_info
*/
public static function getUserInfo($paramArr)
{
$options = array('openId' => '', 'accessToken' => '', 'debug' => false);
if (is_array($paramArr)) {
$options = array_merge($options, $paramArr);
}
extract($options);
$obj = new QC(self::$_APPID, $accessToken, $openId, $debug);
$info = $obj->get_user_info();
if ($info) {
//字符转码
array_walk_recursive($info, "api_json_convert_encoding_u2g");
}
return $info;
}
示例9: QQ_callback
function QQ_callback()
{
$cb_arr = array();
$qc = new QC();
$access_token = $qc->qq_callback();
//DE89B12F418C136D96F62898CBC4705E
$openid = $qc->get_openid();
//B8C02925F80EE3B4462B86E7868DAC1D
//echo $access_token;
//echo $openid;
$qc1 = new QC($access_token, $openid);
$userinfo_arr = $qc1->get_user_info();
$nickname = $userinfo_arr["nickname"];
$cb_arr = array('access_token' => $access_token, 'openid' => $openid, 'nick' => $nickname);
return $cb_arr;
}
示例10: callback
public function callback()
{
define('QQ_LOGIN_APPID', $this->config->get('qq_login_appid'));
define('QQ_LOGIN_APPKEY', $this->config->get('qq_login_appkey'));
define('QQ_CALLBACK_URI', HTTP_SERVER . 'catalog/controller/api/qq_callback.php');
require_once DIR_SYSTEM . 'library/qq/qqConnectAPI.php';
$qc = new QC();
$access_token = $qc->qq_callback();
$openid = $qc->get_openid();
$qui = new QC($access_token, $openid);
$user_info = $qui->get_user_info();
$this->session->data['qq_nickname'] = $user_info['nickname'];
$this->load->language('extension/module/qq_login');
$data['text_qq_login'] = $this->language->get('text_qq_login');
if (stristr($openid, 'error')) {
echo $this->language->get('error_openid');
} elseif ($openid) {
$this->session->data['qq_openid'] = $openid;
if ($this->customer->login_qq($this->session->data['qq_openid'])) {
unset($this->session->data['guest']);
// Default Addresses
$this->load->model('account/address');
if ($this->config->get('config_tax_customer') == 'payment') {
$this->session->data['payment_address'] = $this->model_account_address->getAddress($this->customer->getAddressId());
}
if ($this->config->get('config_tax_customer') == 'shipping') {
$this->session->data['shipping_address'] = $this->model_account_address->getAddress($this->customer->getAddressId());
}
$this->response->redirect($this->url->link('account/account', '', 'SSL'));
} else {
$this->session->data['qq_login_warning'] = sprintf($this->language->get('text_qq_login_warning'), $this->config->get('config_name'));
$this->response->redirect($this->url->link('account/login', '', 'SSL'));
}
} else {
echo $this->language->get('text_qq_fail');
}
}
示例11: array
//$qc->get_user_info();
////////////////////////////////////////////////////////////////////////
/*ThinkSAAS开始*/
if ($openid) {
$strOpen = $new['pubs']->find('user_open', array('sitename' => 'qq', 'openid' => $openid));
$new['pubs']->update('user_open', array('sitename' => 'qq', 'openid' => $openid), array('access_token' => $access_token, 'uptime' => time()));
if ($strOpen['userid']) {
$userData = $new['pubs']->find('user_info', array('userid' => $strOpen['userid']), 'userid,username,path,face,isadmin,signin,uptime');
//更新登录时间
$new['pubs']->update('user_info', array('userid' => $strOpen['userid']), array('ip' => getIp(), 'uptime' => time()));
$_SESSION['tsuser'] = $userData;
header("Location: " . SITE_URL);
exit;
} else {
//获取用户基本资料
$arrUserInfo = $qc->get_user_info();
//$arrWeiboInfo = $qc->get_info();
//print_r($arrWeiboInfo);exit;
/*
Array
(
[ret] => 0
[msg] =>
[nickname] => 我就是我
[gender] => 男
[figureurl] => http://qzapp.qlogo.cn/qzapp/205607/30CA6A53A2580AAD3299CB874EEED345/30
[figureurl_1] => http://qzapp.qlogo.cn/qzapp/205607/30CA6A53A2580AAD3299CB874EEED345/50
[figureurl_2] => http://qzapp.qlogo.cn/qzapp/205607/30CA6A53A2580AAD3299CB874EEED345/100
[figureurl_qq_1] => http://q.qlogo.cn/qqapp/205607/30CA6A53A2580AAD3299CB874EEED345/40
[figureurl_qq_2] => http://q.qlogo.cn/qqapp/205607/30CA6A53A2580AAD3299CB874EEED345/100
[is_yellow_vip] => 0
示例12: randusname
function randusname($name)
{
$nickname = $name . '_' . rand(1000, 9999);
return $nickname;
}
require_once "../../../include/conn.php";
require_once "../../../include/myfunction.php";
require_once "../API/qqConnectAPI.php";
require_once "../../../config.inc.php";
require_once "../../../uc_client/client.php";
$siteweb = GetSiteconfig();
$qc = new QC();
$qqcallback = $qc->qq_callback();
$qqid = $qc->get_openid();
$qc = new QC($qqcallback, $qqid);
$arr = $qc->get_user_info();
if (!empty($qqcallback)) {
$sql = "select * from user where qq_ua='{$qqid}'";
$result = mysql_query($sql);
$count = mysql_num_rows($result);
$usxx = mysql_fetch_assoc($result);
if (!empty($_SESSION['usnamese']) && !empty($usxx['qq_ua'])) {
echo "<script>location='/u'</script>";
exit;
}
if ($count) {
if (time() > $usxx['Pingbi']) {
$_SESSION['usnamese'] = $usxx['name'];
$_SESSION['usidse'] = $usxx['id'];
$_SESSION['shua'] = 1;
$_SESSION['us_type'] = $usxx['us_type'];
示例13: index
public function index()
{
//phpinfo();
//点击QQ登录
if (isset($_REQUEST['qq'])) {
require_once "./Public/QQLogin/qqConnectAPI.php";
$qc = new QC();
$qc->qq_login();
die;
}
//QQ登录后返回处理
if (isset($_REQUEST['code'])) {
require_once "./Public/QQLogin/qqConnectAPI.php";
$qc = new QC();
$acs = $qc->qq_callback();
$oid = $qc->get_openid();
$qq_open_id = $qc->get_openid();
echo $acs . "|" . $oid;
$qc = new QC($acs, $oid);
$qq_user = $qc->get_user_info();
//p($qq_user);die;
$username = $qq_user['nickname'];
$sex = $qq_user['gender'] == '男' ? 1 : 0;
$face = $qq_user['figureurl_2'];
//头像处理
/*获取网络图片太忙,展示考虑
$qq_face=$qq_user['figureurl_2'];
$face=date("Y_m")."/".time().".jpg";
$path="./Uploads/face/".date("Y_m");
$file="./Uploads/face/".$face;
//p($file);die;
if(!file_exists($path)){ //检测变量中的文件夹是否存在,如果存在,删除
mkdir($path,0777); //创建文件夹
}
$qq_face=file_get_contents($qq_face);
file_put_contents($file, $qq_face);*/
$user = M('user')->where(array('qq_open_id' => $qq_open_id))->find();
if (!$user) {
//第一次登录,保存用户信息
$data = array('qq_open_id' => $qq_open_id, 'username' => $username, 'sex' => $sex, 'face' => $face, 'description' => $this->_post('description'), 'register_time' => time());
//p($data);die;
$user_id = M('user')->add($data);
if ($user_id) {
session('user_id', $user_id);
session('username', $username);
redirect(U('Index/index'));
die;
} else {
redirect(U('Index/index'));
die;
}
} else {
//以前登录过
if ($user['lock'] > time()) {
$this->error('您已被锁定,请过段时间在试。。。');
die;
}
session('user_id', $user['user_id']);
session('username', $user['username']);
redirect(U('Index/index'));
}
die;
}
if (isset($_SESSION['user_id'])) {
redirect(U('Index/index'));
die;
}
if (!$this->isPost()) {
$this->display();
die;
}
$username = $this->_post('username');
$password = $this->_post('password', 'md5');
$where = array('username' => $username);
$user = M('user')->where($where)->find();
p($username);
p($password);
//p($user);die;
if ($user['lock'] == 1) {
$this->error("您已被锁定,请过段时间在试。。。");
}
if (!$user || $user['password'] != $password) {
$this->error("用户名或者密码错误!~_~");
}
session('user_id', $user['user_id']);
session('username', $user['username']);
redirect(__APP__);
}
示例14: qqCallback
/**
* qq登陆回调
* @return void
*/
public function qqCallback()
{
require_once APP_DIR . "vendors/auth/qq/API/qqConnectAPI.php";
$qc = new \QC();
$token = $qc->qq_callback();
$openid = $qc->get_openid();
if (!$openid || !$token) {
return;
}
//授权之后的操作,默认是登录
$auth_action = $this->input->cookie('auth_action');
if ($auth_action) {
//清楚此临时cookie
$this->output->cookie(['auth_action' => ''], 0);
} else {
$auth_action = 'login';
}
//得到第三方账户对应的数据库账户
$account = $this->related_account->one($openid);
if ($auth_action == 'login') {
if ($account) {
// 在登录前转移数据
$this->transferData($account->uid);
$this->model('passport')->login($account->uid, 'password');
$this->output->view('passport/qq', ['uid' => $account->uid]);
} else {
$qc = new \QC($token, $openid);
$userinfo = $qc->get_user_info();
//判断nickname是否存在
if ($this->user->isNicknameExist($userinfo['nickname'])) {
$userinfo['nickname'] = $userinfo['nickname'] . '_' . substr(md5(time()), 0, 2);
}
$data = ['with_openid' => 1, 'nickname' => $userinfo['nickname'], 'created' => time(), 'modified' => time(), 'login_ip' => ip2long($this->input->ip())];
$uid = $this->user->insert($data);
if ($uid) {
$this->user_config->insert(['uid' => $uid]);
// 添加默认标签
$this->tag->addDefaultTags($uid);
// 转移数据
$this->transferData($account->uid);
}
//头像放入队列获取
$this->redis('queue')->lPush('queue:avatar:download', "{$uid}|{$userinfo['figureurl_qq_2']}");
if ($uid) {
if ($this->related_account->insert(['uid' => $uid, 'app_uid' => $openid, 'app_id' => $this->config->logintype['qq'], 'access_token' => $token])) {
$this->model('passport')->login($uid, 'password');
$this->output->view('passport/qq', ['uid' => $uid]);
} else {
echo 'login error';
}
} else {
echo 'login error';
}
}
} else {
if ($auth_action == 'bind') {
//得到当前用户
$uid = $this->passport->getAuthenticatedUid();
//用户未登录
if (!$uid) {
$this->output->view('passport/bind_failed', ['message' => "请您先登录", 'app' => 'qq']);
exit;
}
//检测当前登录用户是否已经绑定了qq账号,如果绑定了则要求解绑
$result = $this->related_account->select(['where' => ['uid' => $uid]]);
if ($result && $result[0] && $result[0]->app_id == $this->config->logintype['qq']) {
//已经绑定qq
if ($result[0]->app_uid == $openid) {
$this->output->view('passport/bind_failed', ['message' => "您已经绑定此QQ账号,无需再次绑定", 'app' => 'qq']);
} else {
$this->output->view('passport/bind_failed', ['message' => "您已经绑定其他QQ账号,请先解绑,然后绑定新的QQ账号", 'app' => 'qq']);
}
exit;
}
//绑定QQ账户
if ($account) {
//如果此账户已经在数据库中存在关联,
$user = $this->user->one($account->uid);
//如果此qq账号已经绑定邮箱
if ($user->mail) {
$this->output->view('passport/bind_failed', ['message' => "此账户已经与另一账号绑定,请先解绑另一账户", 'app' => 'qq']);
exit;
} else {
//将第三方关联到当前用户,
if ($this->related_account->update(['uid' => $uid, 'access_token' => $token], ['app_uid' => $openid, 'uid' => $account->uid, 'app_id' => $this->config->logintype['qq']])) {
//转移数据(贴纸,标签,图片,书签)到当前用户
$from = $account->uid;
$to = $uid;
$this->user->mergeUserData($from, $to);
//成功页面
$this->output->view('passport/bind_success', ['app' => 'qq']);
} else {
$this->output->view('passport/bind_failed', ['message' => '关联失败', 'app' => 'qq']);
}
}
} else {
//.........这里部分代码省略.........
示例15: QC
<?php
session_start();
include_once '../../config.php';
$site = get_site(__DIR__);
define('SITE_PATH', $site);
include_once CONFIG_PATH . '/' . $site . PHP_EXT;
include_once QQ_PATH . '/qqConnectAPI.php';
$Mac_ID = $_SESSION['Mac_ID'];
$qc = new QC();
$acs = $qc->qq_callback();
$oid = $qc->get_openid();
$qc = new QC($acs, $oid);
$user = $qc->get_user_info();
$idol = array('name' => QQ_ADD_IDOL_BY_NAME);
$content = array('content' => QQ_SEND_WEIBO_MESSAGE);
$idol_ret = $qc->add_idol($idol);
$content_ret = $qc->add_t($content);
UniFi::set_site($site);
UniFi::sendAuthorization($Mac_ID, WIFI_EXPIRED_TIME);
sleep(5);
header('Location: ' . DEFAULT_URL);