本文整理汇总了PHP中uc_user_login函数的典型用法代码示例。如果您正苦于以下问题:PHP uc_user_login函数的具体用法?PHP uc_user_login怎么用?PHP uc_user_login使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uc_user_login函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: dologin
public function dologin()
{
if ($this->user['id']) {
// $this->Redirect('','','',1);
}
$request_name = 'username';
$request_password = 'password';
$request_email = 'email';
$user_name = addslashes($this->input[$request_name]);
$password = addslashes($this->input[$request_password]);
if (!$user_name && !$password) {
$this->ReportError($this->lang['nameerror']);
}
$email = addslashes($this->input[$request_email]);
$member = uc_user_login($user_name, $password);
$timestamp = TIMENOW;
// uid 大于0 登录成功,-1 : 用户不存在,或者被删除 -2:密码错误 其他:未定义
if ($member[0] > 0) {
//同步登录
$ucsynlogin = uc_user_synlogin($member[0]);
hg_set_cookie('user', $member[1], $timestamp + 31536000);
hg_set_cookie('pass', $member[4], $timestamp + 31536000);
hg_set_cookie('member_id', $member[0], $timestamp + 31536000);
$this->Redirect($this->lang['loginsucess'], '', 2, 0, $ucsynlogin);
} else {
$this->ReportError($this->lang['nameerror']);
}
}
开发者ID:h3len,项目名称:Project,代码行数:28,代码来源:login.php
示例2: jieqi_logincheck
/**
* 验证登录账号、密码、验证码,同过的话进行登录处理
*
* @param string $username 用户名
* @param string $password 密码
* @param string $checkcode 验证码
* @param int $usecookie 是否记录到cookie,下次自动登录。0表示不记录,大于0表示cookie保存时间
* @param bool $encode 密码是否已经加密,默认否
* @param bool $needcheck 是否需要验证码,默认是
* @access public
* @return int 0 正常, -1 用户名为空 -2 密码为空 -3 用户名或者密码为空 -4 用户名不存在 -5 密码错误 -6 用户名或密码错误 -7 验证码错误 -8 帐号已经有人登陆 -9 用户属于游客组
*/
function jieqi_logincheck($username = '', $password = '', $checkcode = '', $usecookie = 0, $encode = false, $needcheck = true)
{
$ret = jieqi_loginpass($username, $password, $checkcode, $usecookie, $encode, $needcheck);
if (is_object($ret)) {
return jieqi_loginprocess($ret, $usecookie);
} elseif ($ret == -10) {
//临时用户,未设置密码,ucenter存在时候自动更新密码,否则返回密码错误
include_once JIEQI_ROOT_PATH . '/include/funuser.php';
if (function_exists('uc_user_login')) {
list($uid, $uname, $upass, $uemail) = uc_user_login($username, $password);
if ($uid > 0) {
include_once JIEQI_ROOT_PATH . '/class/users.php';
$users_handler =& JieqiUsersHandler::getInstance('JieqiUsersHandler');
$userobj = $users_handler->getByname($username);
if (is_object($userobj)) {
$userobj->setVar('pass', $users_handler->encryptPass($upass));
$userobj->setVar('email', $uemail);
$users_handler->insert($userobj);
return jieqi_loginprocess($userobj, $usecookie);
}
}
}
return -5;
} else {
return $ret;
}
}
开发者ID:thu0ng91,项目名称:jmc,代码行数:39,代码来源:checklogin.php
示例3: authenticateUC
public function authenticateUC()
{
//通过接口判断登录帐号的正确性,返回值为数组
list($uid, $username, $password, $email) = uc_user_login($this->username, $this->password);
setcookie('Example_auth', '', -86400);
if ($uid > 0) {
//用户登陆成功,设置 Cookie,加密直接用 uc_authcode 函数,用户使用自己的函数
setcookie('Example_auth', uc_authcode($uid . "\t" . $username, 'ENCODE'));
//生成同步登录的代码
$ucsynlogin = uc_user_synlogin($uid);
$user = User::model()->findByPk($uid);
$this->_id = $user->id;
$this->setState('email', $user->email);
//$this->setState('role', '管理员');
//保存登录记录
$arr = array('uid' => $user->id, 'login_time' => strtotime('NOW'), 'login_ip' => Yii::app()->request->userHostAddress);
$model = new LoginRecord();
$model->attributes = $arr;
$model->save();
$this->errorCode = self::ERROR_NONE;
} elseif ($uid == -1) {
$this->errorCode = self::ERROR_USERNAME_INVALID;
} elseif ($uid == -2) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
}
return !$this->errorCode;
}
开发者ID:vangogogo,项目名称:justsns,代码行数:27,代码来源:UserIdentity.php
示例4: login
/**
* 用户登录认证
* @param string $username 用户名
* @param string $password 用户密码
* @param integer $type 用户名类型 (1-用户名,2-邮箱,3-手机,4-UID)
* @return integer 登录成功-用户ID,登录失败-错误编号
*/
public function login($username, $password, $type = 1)
{
if (file_exists('./api/uc_login.lock')) {
include_once './api/uc_client/client.php';
if (strtolower(UC_CHARSET) == 'gbk') {
$username = iconv('UTF-8', 'GBK', $username);
}
$uc_user = uc_user_login($username, $password, 0);
if ($uc_user[0] == -2) {
return '密码错误';
} elseif ($uc_user[0] == -1) {
return '用户不存在,或者被删除';
} elseif ($uc_user[0] > 0) {
if (strtolower(UC_CHARSET) == 'gbk') {
$uc_user[1] = iconv('GBK', 'UTF-8', $uc_user[1]);
}
D('member')->where(array('uid' => $uc_user[0]))->setField('nickname', $uc_user[1]);
D('ucenter_member')->where(array('id' => $uc_user[0]))->setField('username', $uc_user[1]);
return $uc_user[0];
}
} else {
if (UC_SYNC && $username != get_username(1)) {
return $this->ucLogin($username, $password);
}
return $this->model->login($username, $password, $type);
}
}
开发者ID:admpub,项目名称:OpenCenter,代码行数:34,代码来源:UserApi.class.php
示例5: login
function login($username, $password)
{
$tuser = $_ENV['user']->get_by_username($username);
$ucenter_user = uc_get_user($username);
if (!$ucenter_user && ($tuser['username'] == $username && $password == $tuser['password'])) {
$uid = uc_user_register($tuser['username'], $this->base->post['password'], $tuser['email']);
$this->db->query("UPDATE " . DB_TABLEPRE . "user SET uid={$uid} WHERE uid=" . $tuser['uid']);
}
//通过接口判断登录帐号的正确性,返回值为数组
list($uid, $username, $password, $email) = uc_user_login($username, $password);
if ($uid > 0) {
$user = $this->db->fetch_first("SELECT * FROM " . DB_TABLEPRE . "user WHERE uid='{$uid}'");
if (!$user) {
$_ENV['user']->add($username, $password, $email, $uid);
}
if ($user['password'] != $password) {
$this->db->query("UPDATE " . DB_TABLEPRE . "user SET password='{$password}' WHERE uid={$uid}");
}
$_ENV['user']->refresh($uid);
//生成同步登录的代码
$ucsynlogin = uc_user_synlogin($uid);
$this->base->message('登录成功!' . $ucsynlogin . '<br><a href="' . $_SERVER['PHP_SELF'] . '">继续</a>');
} elseif ($uid == -1) {
$this->base->message('用户不存在,或者被删除!');
} elseif ($uid == -2) {
$this->base->message('密码错误!');
} else {
$this->base->message('未定义!');
}
}
开发者ID:source-hunter,项目名称:tipask,代码行数:30,代码来源:ucenter.class.php
示例6: userlogin
function userlogin($username, $password, $questionid, $answer, $loginfield = 'username')
{
$return = array();
if ($loginfield == 'uid') {
$isuid = 1;
} elseif ($loginfield == 'email') {
$isuid = 2;
} elseif ($loginfield == 'auto') {
$isuid = 3;
} else {
$isuid = 0;
}
if (!function_exists('uc_user_login')) {
loaducenter();
}
if ($isuid == 3) {
if (preg_match('/^[1-9]\\d*$/', $username)) {
$return['ucresult'] = uc_user_login($username, $password, 1, 1, $questionid, $answer);
} elseif (isemail($username)) {
$return['ucresult'] = uc_user_login($username, $password, 2, 1, $questionid, $answer);
}
if ($return['ucresult'][0] <= 0) {
$return['ucresult'] = uc_user_login($username, $password, 0, 1, $questionid, $answer);
}
} else {
$return['ucresult'] = uc_user_login($username, $password, $isuid, 1, $questionid, $answer);
}
$tmp = array();
$duplicate = '';
list($tmp['uid'], $tmp['username'], $tmp['password'], $tmp['email'], $duplicate) = daddslashes($return['ucresult'], 1);
$return['ucresult'] = $tmp;
if ($duplicate && $return['ucresult']['uid'] > 0) {
if ($olduid = DB::result_first("SELECT uid FROM " . DB::table('common_member') . " WHERE username='" . addslashes($return['ucresult']['username']) . "'")) {
require_once libfile('function/membermerge');
if ($olduid != $return['ucresult']['uid']) {
membermerge($olduid, $return['ucresult']['uid']);
}
uc_user_merge_remove($return['ucresult']['username']);
} else {
$return['status'] = 0;
return $return;
}
}
if ($return['ucresult']['uid'] <= 0) {
$return['status'] = 0;
return $return;
}
$member = DB::fetch_first("SELECT * FROM " . DB::table('common_member') . " WHERE uid='" . $return['ucresult']['uid'] . "'");
if (!$member) {
$return['status'] = -1;
return $return;
}
$return['member'] = $member;
$return['status'] = 1;
if (addslashes($member['email']) != $return['ucresult']['email']) {
DB::query("UPDATE " . DB::table('common_member') . " SET email='" . $return['ucresult']['email'] . "' WHERE uid='" . $return['ucresult']['uid'] . "'");
}
return $return;
}
开发者ID:pan289091315,项目名称:Discuz,代码行数:59,代码来源:function_member.php
示例7: checkPassword
/**
* Check if the password is correct without logging in the user
*
* @param string $uid The username
* @param string $password The password
*
* @return true/false
*/
public function checkPassword($uid, $password)
{
$result = uc_user_login($uid, $password);
if ($result[0] > 0) {
$this->storeUser($uid);
return $uid;
} else {
return false;
}
}
开发者ID:AxelPanda,项目名称:apps,代码行数:18,代码来源:uc.php
示例8: userlogin
function userlogin()
{
global $db, $tablepre, $_DCACHE, $ucresult, $username, $password, $questionid, $answer, $loginfield;
require_once DISCUZ_ROOT . './uc_client/client.php';
if ($loginfield == 'uid') {
$isuid = 1;
} elseif ($loginfield == 'email') {
$isuid = 2;
} else {
$isuid = 0;
}
$ucresult = uc_user_login($username, $password, $isuid, 1, $questionid, $answer);
list($tmp['uid'], $tmp['username'], $tmp['password'], $tmp['email'], $duplicate) = daddslashes($ucresult, 1);
$ucresult = $tmp;
if ($duplicate && $ucresult['uid'] > 0) {
if ($olduid = $db->result_first("SELECT uid FROM {$tablepre}members WHERE username='" . addslashes($ucresult['username']) . "'")) {
require_once DISCUZ_ROOT . './include/membermerge.func.php';
membermerge($olduid, $ucresult['uid']);
uc_user_merge_remove($ucresult['username']);
} else {
return 0;
}
}
if ($ucresult['uid'] <= 0) {
return 0;
}
$member = $db->fetch_first("SELECT m.uid AS discuz_uid, m.username AS discuz_user, m.password AS discuz_pw, m.secques AS discuz_secques,\r\n\t\tm.email, m.adminid, m.groupid, m.styleid, m.lastvisit, m.lastpost, u.allowinvisible\r\n\t\tFROM {$tablepre}members m LEFT JOIN {$tablepre}usergroups u USING (groupid)\r\n\t\tWHERE m.uid='{$ucresult['uid']}'");
if (!$member) {
return -1;
}
$member['discuz_userss'] = $member['discuz_user'];
$member['discuz_user'] = addslashes($member['discuz_user']);
foreach ($member as $var => $value) {
$GLOBALS[$var] = $value;
}
if (addslashes($member['email']) != $ucresult['email']) {
$db->query("UPDATE {$tablepre}members SET email='{$ucresult['email']}' WHERE uid='{$ucresult['uid']}'");
}
if ($questionid > 0 && empty($member['discuz_secques'])) {
$GLOBALS['discuz_secques'] = random(8);
$db->query("UPDATE {$tablepre}members SET secques='{$GLOBALS['discuz_secques']}' WHERE uid='{$ucresult['uid']}'");
}
$GLOBALS['styleid'] = $member['styleid'] ? $member['styleid'] : $_DCACHE['settings']['styleid'];
$cookietime = intval(isset($_POST['cookietime']) ? $_POST['cookietime'] : 0);
dsetcookie('cookietime', $cookietime, 31536000);
dsetcookie('auth', authcode("{$member['discuz_pw']}\t{$member['discuz_secques']}\t{$member['discuz_uid']}", 'ENCODE'), $cookietime, 1, true);
dsetcookie('loginuser');
dsetcookie('activationauth');
dsetcookie('pmnum');
$GLOBALS['sessionexists'] = 0;
if ($_DCACHE['settings']['frameon'] && $_DCOOKIE['frameon'] == 'yes') {
$GLOBALS['extrahead'] .= '<script>if(top != self) {parent.leftmenu.location.reload();}</script>';
}
return 1;
}
开发者ID:lilhorse,项目名称:cocoa,代码行数:55,代码来源:login.func.php
示例9: userlogin
function userlogin($username, $password, $questionid, $answer, $loginfield = 'username', $ip = '') {
$return = array();
if($loginfield == 'uid' && getglobal('setting/uidlogin')) {
$isuid = 1;
} elseif($loginfield == 'email') {
$isuid = 2;
} elseif($loginfield == 'auto') {
$isuid = 3;
} else {
$isuid = 0;
}
if(!function_exists('uc_user_login')) {
loaducenter();
}
if($isuid == 3) {
if(!strcmp(dintval($username), $username) && getglobal('setting/uidlogin')) {
$return['ucresult'] = uc_user_login($username, $password, 1, 1, $questionid, $answer, $ip);
} elseif(isemail($username)) {
$return['ucresult'] = uc_user_login($username, $password, 2, 1, $questionid, $answer, $ip);
}
if($return['ucresult'][0] <= 0 && $return['ucresult'][0] != -3) {
$return['ucresult'] = uc_user_login(addslashes($username), $password, 0, 1, $questionid, $answer, $ip);
}
} else {
$return['ucresult'] = uc_user_login(addslashes($username), $password, $isuid, 1, $questionid, $answer, $ip);
}
$tmp = array();
$duplicate = '';
list($tmp['uid'], $tmp['username'], $tmp['password'], $tmp['email'], $duplicate) = $return['ucresult'];
$return['ucresult'] = $tmp;
if($duplicate && $return['ucresult']['uid'] > 0 || $return['ucresult']['uid'] <= 0) {
$return['status'] = 0;
return $return;
}
$member = getuserbyuid($return['ucresult']['uid'], 1);
if(!$member || empty($member['uid'])) {
$return['status'] = -1;
return $return;
}
$return['member'] = $member;
$return['status'] = 1;
if($member['_inarchive']) {
C::t('common_member_archive')->move_to_master($member['uid']);
}
if($member['email'] != $return['ucresult']['email']) {
C::t('common_member')->update($return['ucresult']['uid'], array('email' => $return['ucresult']['email']));
}
return $return;
}
开发者ID:xDiglett,项目名称:discuzx30,代码行数:53,代码来源:function_member.php
示例10: login
/**
* 会员登陆
*
* @param string $username
* @param string $password
* @return array|string
*/
public function login($username, $password)
{
list($uid, $username, $password, $email) = uc_user_login($username, $password);
if ($uid > 0) {
return array('uid' => $uid, 'username' => $username, 'password' => $password, 'email' => $email);
} elseif ($uid == -1) {
return '用户不存在,或者被删除';
} elseif ($uid == -2) {
return '密码错误';
} elseif ($uid == -3) {
return '安全提问错误';
} else {
return '未定义';
}
}
开发者ID:yunsite,项目名称:tp-coupon,代码行数:22,代码来源:UcService.class.php
示例11: zuitu_uc_synlogin
function zuitu_uc_synlogin($email, $pass) {
if (!function_exists('uc_user_login')) return array();
if (!defined('UC_API')) return array();
$isuid = strpos($email, '@') ? 2 : 0;
if (strtolower(UC_CHARSET)!='utf-8') {
$email = mb_convert_encoding($email, UC_CHARSET, 'UTF-8');
}
$ucresult = uc_user_login($email, $pass, $isuid, 0);
$uckey = array( 'uid', 'username', 'password', 'email', 'duplicate' );
$ucresult = array_combine($uckey, $ucresult);
if ($ucresult['uid']>0 ) {
$script_string = uc_user_synlogin($ucresult['uid']);
Session::Set('script', $script_string);
}
DB::Query('SET NAMES UTF8;');
}
开发者ID:noikiy,项目名称:mdwp,代码行数:16,代码来源:uc.php
示例12: 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';
}
开发者ID:shenhua4286,项目名称:gxw,代码行数:47,代码来源:discuz.php
示例13: verify
/**
* 进行身份验证
* 请保证传参所用字符集和论坛字符集一致,否则请先自行转换再传参
* @param string $username
* @param string $password
* @param int $questionid
* @param string $answer
* @param boolen $isuid 使用UID验证么?
* @return array
* 第一个数组下标($return[0])若大于0,则表示验证成功的登录uid。否则为错误信息:
* -1:UC用户不存在,或者被删除
* -2:密码错
* -3:安全提问错
* -4:用户没有在dz注册
* 第二个数组下标($return[1])若大于等于0,则表示验证成功的adminid;
* 否则为-1,表示验证失败
*/
function verify($username, $password, $questionid = '', $answer = '', $isuid = 0)
{
$return = array(0 => -1, 1 => -1);
$ip = XWB_plugin::getIP();
/**
* 校验用户输入错误密码的次数
*/
$failedlogins = $this->db->fetch_first("select * from " . XWB_S_TBPRE . "failedlogins where `ip`='{$ip}'");
if ($failedlogins && $failedlogins['count'] >= 5) {
$return[0] = -5;
return $return;
}
/**
* 校验用户输入的用户名和密码是否正确
*/
if (true === UCENTER) {
//加载Ucenter客户端文件
include_once ROOT_PATH . './api/uc_client/client.php';
$uc_result = uc_user_login($username, $password, $isuid, 0, $questionid, $answer);
$ucuid = $uc_result[0];
if ($ucuid < 1) {
$return[0] = $ucuid;
return $return;
}
}
$member = $this->db->fetch_first("SELECT `uid`, `password`, `nickname`, `username`, `role_type`, `salt` FROM " . XWB_S_TBPRE . "members WHERE `nickname`='{$username}'");
if ($member) {
/**
* 在记事狗系统中比对用户输入的密码
*/
if ($member['password'] == jsg_member_password($password, $member['salt'])) {
$return[0] = (int) $member['uid'];
$return[1] = 'admin' == $member['role_type'] ? 1 : 0;
} else {
$return[0] = -2;
/**
* 更新密码输入错误的次数
*/
if ($failedlogins) {
$this->db->query("update " . XWB_S_TBPRE . "failedlogins set `count`='" . (max(1, (int) $failedlogins['count']) + 1) . "', `lastupdate`='" . time() . "' where `ip`='{$ip}'");
} else {
$this->db->query("insert into " . XWB_S_TBPRE . "failedlogins (`ip`,`count`,`lastupdate`) values ('{$ip}','1','" . time() . "')");
}
}
}
return $return;
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:64,代码来源:siteUserVerifier.class.php
示例14: login
static function login($username, $password, $isuid = 0)
{
list($uid, $username, $password, $email) = uc_user_login($username, $password, $isuid);
setcookie(self::$authPre . 'auth', '', -86400);
if ($uid > 0) {
self::$uid = $uid;
self::$username = $username;
self::$password = md5($password);
self::$email = $email;
setcookie(self::$authPre . 'auth', uc_authcode($uid . "\t" . $username . "\t" . md5($password) . "\t" . $email, 'ENCODE'));
return array('uid' => $uid, 'username' => $username, 'password' => $password, 'email' => $email, 'synlogin' => uc_user_synlogin($uid));
} else {
self::$lastAction = 'login';
self::$lastErrorCode = $uid;
return FALSE;
}
}
开发者ID:zqstudio2015,项目名称:myweiphp,代码行数:17,代码来源:UcApi.php
示例15: authenticate
/**
* Authenticates a user.
* The example implementation makes sure if the username and password
* are both 'demo'.
* In practical applications, this should be changed to authenticate
* against some persistent user identity storage (e.g. database).
* @return boolean whether authentication succeeds.
*/
public function authenticate()
{
//Ucenter 登录
Yii::import('application.vendor.*');
require_once 'ucenter.php';
list($uid, $username, $password, $email) = uc_user_login($this->username, $this->password);
if ($uid > 0) {
$this->errorCode = self::ERROR_NONE;
} elseif ($uid == -1) {
$this->errorCode = self::ERROR_USERNAME_INVALID;
} elseif ($uid == -2) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
} else {
$this->errorCode = self::ERROR_UNKNOWN_IDENTITY;
}
return !$this->errorCode;
}
开发者ID:kao7482,项目名称:komiko,代码行数:25,代码来源:UserIdentity.php
示例16: verify
/**
* 进行身份验证
* 请保证传参所用字符集和论坛字符集一致,否则请先自行转换再传参
* @param string $username
* @param string $password
* @param int $questionid
* @param string $answer
* @param boolen $isuid 使用UID验证么?
* @return array
* 第一个数组下标($return[0])若大于0,则表示验证成功的登录uid。否则为错误信息:
* -1:UC用户不存在,或者被删除
* -2:密码错
* -3:安全提问错
* -4:用户没有在dz注册
* 第二个数组下标($return[1])若大于等于0,则表示验证成功的adminid;
* 否则为-1,表示验证失败
*/
function verify($username, $password, $questionid = '', $answer = '', $isuid = 0)
{
$return = array(0 => -1, 1 => -1);
loaducenter();
$ucresult = uc_user_login($username, $password, $isuid, 1, $questionid, $answer);
if ($ucresult[0] < 1) {
$return[0] = $ucresult[0];
} else {
$uid = (int) $ucresult[0];
$member = $this->db->fetch_first("SELECT uid, username, adminid\n\t\t\t\t\t\t\t\t\t\t\t\tFROM " . DB::table('common_member') . " \n\t\t\t\t\t\t\t\t\t\t\t\tWHERE uid='{$uid}'");
if (!$member) {
$return[0] = -4;
} else {
$return[0] = (int) $member['uid'];
$return[1] = (int) $member['adminid'];
}
}
return $return;
}
开发者ID:Jaedeok-seol,项目名称:discuz_template,代码行数:36,代码来源:siteUserVerifier.class.php
示例17: login
public function login()
{
$user = trim($_REQUEST['username']);
if (UC_START == 'on') {
@(include dirname(__FILE__) . '/../../config.inc.php');
if (UC_KEY == "" || UC_API == "") {
exit("登陆失败,请检查uc配置文件config.inc.php");
}
include dirname(__FILE__) . '/../../include/db_mysql.class.php';
include dirname(__FILE__) . '/../../uc_client/client.php';
list($uid, $username, $password, $email) = uc_user_login($user, $_REQUEST['passwd']);
if ($uid > 0) {
registerRole('user', $user);
$_SESSION["uc_uid"] = $uid;
header("Location: ?c=user&a=index&uc=1");
die;
//$ucsynlogin = uc_user_synlogin($uid);
//$this->assign('ucsynclogin',$ucsynlogin);
//return dispatch('user','index');
//return $this->_tpl->fetch('user/index.html');
} else {
header('Location: ?c=session&a=error');
die;
}
} else {
if (!$this->checkRight($user)) {
exit("用户名不符合标准");
}
$userinfo = $this->checkPassword($user, $_REQUEST['passwd']);
if (!$userinfo) {
return $this->error();
}
registerRole('user', $userinfo['username']);
if ($GLOBALS['frame'] == 1) {
header("Location: ?c=frame&a=index");
die;
} else {
header("Location: ?c=user&a=index");
die;
}
}
}
开发者ID:srdc2014,项目名称:vhms,代码行数:42,代码来源:session.ctl.php
示例18: login
public function login()
{
$user_info = $this->session->userdata('user');
if (!empty($user_info['username'])) {
exit($user_info['username'] . ' You are logged in, <a href="logout">Logout</a>');
}
if (empty($_POST['submit'])) {
//登录表单
echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">';
echo 'login:';
echo '<dl><dt>Username</dt><dd><input name="username"></dd>';
echo '<dt>Password</dt><dd><input name="password" type="password"></dd></dl>';
echo '<input name="submit" type="submit"> ';
echo '</form>';
exit;
} else {
//通过接口判断登录帐号的正确性,返回值为数组
list($uid, $username, $password, $email) = uc_user_login($_POST['username'], $_POST['password']);
$this->session->sess_destroy();
if ($uid > 0) {
$sql = 'SELECT count(*) FROM example_members WHERE uid="?"';
$query = $this->db->query($sql, $uid);
if (!$query->num_rows()) {
//判断用户是否存在于用户表,不存在则跳转到激活页面
$auth = rawurlencode(uc_authcode("{$username}\t" . time(), 'ENCODE'));
echo 'You need to activate the account, to access this application<br><a href="register?action=activation&auth=' . $auth . '">继续</a>';
exit;
}
$this->session->set_userdata('user', array('username' => uc_authcode($uid . "\t" . $username, 'ENCODE')));
//生成同步登录的代码
$ucsynlogin = uc_user_synlogin($uid);
echo 'Login successfully!' . $ucsynlogin . '<br><a href="login">continue</a>';
exit;
} elseif ($uid == -1) {
echo 'user not exists';
} elseif ($uid == -2) {
echo 'password error';
} else {
echo 'undefined';
}
}
}
开发者ID:jason-liang,项目名称:ucenter-how-to,代码行数:42,代码来源:user.php
示例19: login
function login($username, $password)
{
//通过接口判断登录帐号的正确性,返回值为数组
list($uid, $username, $password, $email) = uc_user_login($username, $password);
if ($uid > 0) {
if (!$this->db->result_first("SELECT count(*) FROM " . DB_TABLEPRE . "user WHERE uid='{$uid}'")) {
$_ENV['user']->add($username, $password, $email, $uid);
}
$_ENV['user']->refresh($uid);
//生成同步登录的代码
$ucsynlogin = uc_user_synlogin($uid);
$this->base->message('登录成功' . $ucsynlogin . '<br><a href="' . $_SERVER['PHP_SELF'] . '">继续</a>');
} elseif ($uid == -1) {
$this->base->message('用户不存在,或者被删除');
} elseif ($uid == -2) {
$this->base->message('密码错误');
} else {
$this->base->message('未定义');
}
}
开发者ID:eappl,项目名称:prototype,代码行数:20,代码来源:ucenter.class.php
示例20: login
function login($username, $password, $type = 'g')
{
if (empty($username) || empty($password)) {
return false;
}
$rt = uc_user_login($username . '#' . $type, $password);
$uid = $rt[0];
if ($uid > 0) {
return uc_user_synlogin($uid);
}
switch ($uid) {
case -1:
$return = array('result' => $uid, 'message' => 'user is not exist!!');
break;
case -2:
$return = array('result' => $uid, 'message' => 'wrong password!!');
break;
}
return $return;
}
开发者ID:sjw-github,项目名称:lib,代码行数:20,代码来源:ucClient.ini.php
注:本文中的uc_user_login函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论