本文整理汇总了PHP中uc_get_user函数的典型用法代码示例。如果您正苦于以下问题:PHP uc_get_user函数的具体用法?PHP uc_get_user怎么用?PHP uc_get_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uc_get_user函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doSynlogin
protected function doSynlogin($request, $get, $post)
{
if (!API_SYNLOGIN) {
return API_RETURN_FORBIDDEN;
}
$partnerUser = uc_get_user($get['uid'], 1);
$bind = $this->getUserService()->getUserBindByTypeAndFromId('discuz', $get['uid']);
if (UC_CHARSET == 'gbk') {
$get['username'] = iconv('gb2312', 'UTF-8', $get['username']);
}
if (empty($bind)) {
$registration = array('nickname' => $get['username'], 'email' => $partnerUser[2], 'password' => substr(base_convert(sha1(uniqid(mt_rand(), true)), 16, 36), 0, 8), 'createdTime' => $get['time'], 'createdIp' => $request->getClientIp(), 'token' => array('userId' => $get['uid']));
if (!$this->getAuthService()->isRegisterEnabled()) {
return API_RETURN_FORBIDDEN;
}
$user = $this->getUserService()->register($registration, 'discuz');
} else {
$user = $this->getUserService()->getUser($bind['toId']);
if (empty($user)) {
return API_RETURN_SUCCEED;
}
}
$this->authenticateUser($user);
return API_RETURN_SUCCEED;
}
示例2: register
function register()
{
$activeuser = uc_get_user($this->base->post['username']);
if ($activeuser) {
$this->base->message('该用户无需注册,请直接登录!<br><a href="index.php?user/login">继续</a>');
}
$uid = uc_user_register($this->base->post['username'], $this->base->post['password'], $this->base->post['email']);
if ($uid <= 0) {
if ($uid == -1) {
$this->base->message('用户名不合法');
} elseif ($uid == -2) {
$this->base->message('包含要允许注册的词语');
} elseif ($uid == -3) {
$this->base->message('用户名已经存在');
} elseif ($uid == -4) {
$this->base->message('Email 格式有误');
} elseif ($uid == -5) {
$this->base->message('Email 不允许注册');
} elseif ($uid == -6) {
$this->base->message('该 Email 已经被注册');
} else {
$this->base->message('未定义');
}
} else {
if (isset($this->base->post['access_token'])) {
$uid = $_ENV['user']->add($this->base->post['username'], $this->base->post['password'], $this->base->post['email'], $uid, $this->base->post['access_token']);
} else {
$_ENV['user']->add($this->base->post['username'], $this->base->post['password'], $this->base->post['email'], $uid);
}
$_ENV['user']->refresh($uid);
$ucsynlogin = uc_user_synlogin($uid);
$this->base->message('注册成功' . $ucsynlogin . '<br><a href="' . $_SERVER['PHP_SELF'] . '">继续</a>');
}
}
示例3: changePassword
public function changePassword($userId, $oldPassword, $newPassword)
{
$this->initDiscuzApi();
$user = uc_get_user($userId, 1);
$result = uc_user_edit($user[1], null, $newPassword, null, 1);
return $result == 1;
}
示例4: register_header
function register_header()
{
global $_G;
$inputemail = 'gp_' . $this->regemail['email'];
$_G['gp_email'] = $_G[$inputemail];
if ($_POST) {
$_G['gp_activationauth'] = strip_tags(str_replace(" ", "+", $_G['gp_activationauth']));
$activationinfo = authcode($_G['gp_activationauth'], $operation = 'DECODE');
$activationinfoname = preg_replace("/\\s.+/i", "", $activationinfo);
if ($activationinfoname) {
loaducenter();
if ($data = uc_get_user($activationinfoname)) {
list($uid, $username, $email) = $data;
}
$_G['gp_email'] = getEmail(strip_tags($email));
} else {
$_G['gp_email'] = getEmail(strip_tags($_G['gp_email']));
}
$_G['gp_rid'] = strip_tags($_G['gp_rid']);
if (!$_G['gp_rid']) {
showmessage('dsu_amufzc:1', '');
}
if (!$_G['gp_email']) {
showmessage('dsu_amufzc:5', '');
}
$amutb = DB::table("plugin_dsuamfzc");
$query = DB::fetch_first("SELECT * FROM {$amutb} WHERE rid = '" . $_G['gp_rid'] . "'");
if (!$query || $query['yes'] == '1') {
showmessage('dsu_amufzc:2', '');
}
if ($_G['gp_email'] != $query['email']) {
showmessage('dsu_amufzc:11', '');
}
}
}
示例5: member
public function member($uname, $isuid = false)
{
if ($data = uc_get_user(addslashes($this->iconv($uname)), (bool) $isuid)) {
list($uid, $uname, $mail) = $data;
return array('uid' => $uid, 'uname' => $this->iconv($uname, true), 'mail' => $mail);
}
return false;
}
示例6: uc_feed_note
function uc_feed_note($username, $feed)
{
$data = uc_get_user($username);
if (!$data) {
return '';
}
$uid = $data[0];
return uc_feed_add($feed['icon'], $uid, $username, $feed['title_template'], $feed['title_data'], $feed['body_template'], $feed['body_data'], '', '', $feed['images']);
}
示例7: actionIndex
public function actionIndex()
{
require_once 'ucenter.php';
if ($data = uc_get_user(Yii::app()->user->name)) {
list($uid, $username, $email) = $data;
} else {
echo '用户不存在';
}
$this->render('index', array('uid' => $uid, 'username' => $username, 'email' => $email));
}
示例8: synlogin
function synlogin($get, $post)
{
!API_SYNLOGIN && exit(API_RETURN_FORBIDDEN);
$ID = intval($get['uid']);
for ($i = 0; $i < 2; $i++) {
$user = get_user_by('id', $ID);
if ($user) {
header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
wp_set_auth_cookie($ID, true, '');
return API_RETURN_SUCCEED;
}
$query = uc_get_user($ID, 1);
createUser($ID, $get['username'], $get['password'], $query[2]);
}
exit(API_RETURN_SUCCEED);
}
示例9: API_Login
function API_Login($user, $pass)
{
global $db, $onlineip;
include_once ONEZ_ROOT . './uc_client/client.php';
$api = uc_user_login($user, $pass, 0);
list($uid, $username, $password, $email) = $api;
if ($uid < 0) {
if ($uid == -1) {
return '用户不存在,或者被删除';
} elseif ($uid == -2) {
return '用户名或密码不正确';
} elseif ($uid == -3) {
return '安全提问错';
}
}
if (!$db) {
include_once ONEZ_ROOT . './include/db_mysql.class.php';
db_local();
$db = new onez_db();
}
$db->reset();
if ($db->rows("users", "uid='{$uid}'") == 0) {
//创建本地用户
if ($data = uc_get_user($uid, 1)) {
list($uid, $username, $email) = $data;
$arr = array('uid' => $uid, 'username' => $username, 'password' => md5($pass), 'email' => $email, 'infoip' => $onlineip, 'infotime' => time());
$db->insert('users', $arr);
}
}
$GLOBALS['cookiepre'] = 'onez_';
osetcookie('userid', $uid, 31536000);
osetcookie('username', $username, 31536000);
echo uc_user_synlogin($uid);
echo <<<ONEZ
<p align="center"><br /><br /><br /><br />
<a href="#" onclick="ReLoad()"><font size="2" color="#0000ff">正在同步登录中...</font></a>
</p>
<script type="text/javascript">
function ReLoad(){
top.location.reload();
}
window.onload=ReLoad;
</script>
ONEZ;
exit;
return 'Y';
}
示例10: UcenterLogin
public function UcenterLogin($data)
{
$db = new dbstuff();
$db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, 0);
list($uid, $username, $email) = uc_get_user($data['username']);
if (is_null($uid)) {
$_data['email'] = $data['email'];
$_data['username'] = $data['username'];
$_data['password'] = $data['password'];
$_data['user_id'] = $data['user_id'];
$uid = self::UcenterReg($_data);
return self::UcenterLogin($data);
} else {
$ucsynlogin = uc_user_synlogin($uid);
}
//var_dump($uid);
return $ucsynlogin;
}
示例11: ajax_reg_action
function ajax_reg_action()
{
$post = array_keys($_POST);
$key_name = $post[0];
if (!in_array($key_name, array('username', 'email'))) {
exit;
}
$Member = $this->MODEL("userinfo");
if ($key_name == "username") {
$username = yun_iconv("utf-8", "gbk", $_POST['username']);
if (!$this->CheckRegUser($username) && !$this->CheckRegEmail($username)) {
echo 2;
die;
}
if ($this->config['sy_uc_type'] == "uc_center") {
$this->uc_open();
$user = uc_get_user($username);
} else {
$user = $Member->GetMemberNum(array("username" => $username));
}
if ($this->config['sy_regname'] != "") {
$regname = @explode(",", $this->config['sy_regname']);
if (in_array($username, $regname)) {
echo 3;
die;
}
}
} elseif ($key_name == "email") {
if (!$this->CheckRegEmail($_POST['email'])) {
echo 2;
die;
}
$user = $Member->GetMemberNum(array("`email`='" . $_POST['email'] . "' or `username`='" . $_POST['email'] . "'"));
}
if ($user) {
echo 1;
} else {
echo 0;
}
}
示例12: ajax_reg_action
function ajax_reg_action()
{
$post = array_keys($_POST);
$key_name = $post[0];
if (!in_array($key_name, array('username', 'email'))) {
exit;
}
if ($key_name == "username") {
$username = $this->stringfilter($_POST['username']);
if (!$this->CheckRegUser($username) && !$this->CheckRegEmail($username)) {
echo 2;
die;
}
if ($this->config['sy_uc_type'] == "uc_center") {
$this->obj->uc_open();
$user = uc_get_user($username);
} else {
$user = $this->obj->DB_select_num("member", "`username`='" . $username . "'");
}
if ($this->config['sy_regname'] != "") {
$regname = @explode(",", $this->config['sy_regname']);
if (in_array($username, $regname)) {
echo 2;
die;
}
}
} elseif ($key_name == "email") {
if (!$this->CheckRegEmail($_POST['email'])) {
echo 2;
die;
}
$user = $this->obj->DB_select_num("member", "`email`='" . $_POST['email'] . "' or `username`='" . $_POST['email'] . "'");
}
if ($user) {
echo 1;
} else {
echo 0;
}
}
示例13: set_login
/**
* 设置用户登陆
*
* @access public
* @param int $uid
* @return void
*/
function set_login($user_id = '', $user_name = '')
{
if (empty($user_id)) {
return;
} else {
$sql = "SELECT user_name, email FROM {pre}users WHERE user_id='$user_id' LIMIT 1";
$row = $GLOBALS['db']->query($sql);
$row = reset($row);
if ($row) {
set_cookie($user_id, $row['user_name'], $row['email']);
set_session($user_id, $row['user_name'], $row['email']);
update_user_info();
} else {
include_once (ROOT_PATH . 'plugins/uc_client/client.php');
if ($data = uc_get_user($user_name)) {
list ($uid, $uname, $email) = $data;
$sql = "REPLACE INTO {pre}users (user_id, user_name, email) VALUES('$uid', '$uname', '$email')";
$GLOBALS['db']->query($sql);
set_login($uid);
} else {
return false;
}
}
}
}
示例14: checkuser
}
checkuser($_POST['id'], $member['authstr']);
uc_user_edit(addslashes($member['username']), $_POST['newpasswd'], $_POST['newpasswd'], $_POST['email'], 1);
updatetable('members', array('authstr' => ''), array('uid' => $_POST['uid']));
showmessage('getpasswd_succeed', geturl('action/login'));
}
$_GET['op'] = trim($_GET['op']);
if ($_GET['op'] == 'reset') {
$_GET['uid'] = intval($_GET['uid']);
$_GET['id'] = trim($_GET['id']);
$query = $_SGLOBAL['db']->query("SELECT uid, username, authstr FROM " . tname('members') . " WHERE uid='{$_GET['uid']}'");
$member = $_SGLOBAL['db']->fetch_array($query);
if (empty($member)) {
showmessage('user_does_not_exist', geturl('action/login'));
}
$user = uc_get_user($member['username']);
checkuser($_GET['id'], $member['authstr']);
}
include template('site_lostpasswd');
//验证地址地否有效
function checkuser($id, $space)
{
global $_SGLOBAL;
if (empty($space)) {
showmessage('link_failure', geturl('action/login'));
}
list($dateline, $operation, $idstring) = explode("\t", $space);
if ($dateline < $_SGLOBAL['timestamp'] - 86400 * 3 || $operation != 1 || $idstring != $id) {
showmessage('getpasswd_illegal');
}
}
示例15: getnewname
public static function getnewname($openid)
{
global $_G;
if (!$_G['wechat']['setting']) {
$_G['wechat']['setting'] = unserialize($_G['setting']['mobilewechat']);
}
$wechat_client = new WeChatClient($_G['wechat']['setting']['wechat_appId'], $_G['wechat']['setting']['wechat_appsecret']);
$userinfo = $wechat_client->getUserInfoById($openid);
if ($userinfo) {
$defaultusername = substr(WeChatEmoji::clear($userinfo['nickname']), 0, 15);
loaducenter();
$user = uc_get_user($defaultusername);
if (!empty($user)) {
$defaultusername = cutstr($defaultusername, 7, '') . '_' . random(5);
}
} else {
$defaultusername = 'wx_' . random(5);
}
return $defaultusername;
}