discuz X3用户登录uc_user_login()函数详解
2013-09-10 10:47
543 查看
discuz X3用户登录uc_user_login()函数详解
验证用户登录 discuz x3/source/function/function_member.php中大约35行左右:
这里的uc_user_login()就是去验证登录是否成功:
返回值
本接口函数用于用户的登录验证,用户名及密码正确无误则返回用户在 UCenter 的基本数据,否则返回相应的错误信息。如果应用程序是升级过来的,并且当前登录用户和已有用户重名,那么返回的数组中 [4] 的值将返回 1。
附加获取用户数据方法:uc_get_user()
返回值
本接口函数用于获取用户在 UCenter 的基本数据,如用户不存在,返回值为 integer 的数值 0。
验证用户登录 discuz x3/source/function/function_member.php中大约35行左右:
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); }
这里的uc_user_login()就是去验证登录是否成功:
用户登录:
array uc_user_login(
string username ,
string password,
bool isuid ,
bool checkques ,
integer questionid ,
string answer
)
函数参数参数 | 含义 |
---|---|
string username | 用户名 / 用户 ID |
string password | 密码 |
bool isuid | 是否使用用户 ID登录 1:使用用户 ID登录 0:(默认值) 使用用户名登录 |
bool checkques | 是否验证安装提问 1:验证安全提问 0:(默认值) 不验证安全提问 |
integer questionid | 安全提问索引 |
string answer | 安全提问答案 |
值 | 含义 | |
---|---|---|
array | integer [0] | 大于 0:返回用户 ID,表示用户登录成功 -1:用户不存在,或者被删除 -2:密码错 -3:安全提问错 |
string [1] | 用户名 | |
string [2] | 密码 | |
string [3] | ||
bool [4] | 用户名是否重名 |
附加获取用户数据方法:uc_get_user()
获取用户数据:
array uc_get_user(
string username,
bool isuid
)
函数参数参数 | 含义 |
---|---|
string username | 用户名 |
bool isuid | 是否使用用户 ID获取 1:使用用户 ID获取 0:(默认值) 使用用户名获取 |
值 | 含义 | |
---|---|---|
array | integer [0] | 用户 ID |
string [1] | 用户名 | |
string [2] |
相关文章推荐
- Sql Server 2005中的架构(Schema)、用户(User)、登录(Login)和角色(Role)
- Sql Server 2005中的架构(Schema)、用户(User)、角色(Role)和登录(Login)(三)
- Sql Server 2005中的架构(Schema)、用户(User)、角色(Role)和登录(Login)(二)
- Sql Server 2005中的架构(Schema)、用户(User)、登录(Login)和角色(Role)
- Sql Server 2005中的架构(Schema)、用户(User)、角色(Role)和登录(Login)(一)
- Sql Server 2005中的架构(Schema)、用户(User)、登录(Login)和角色(Role)(一)
- 解决员工更换工号后通过SPContext.Current.Web.CurrentUser.LoginName查找当前登录用户还是原来工号的问题
- Sql Server 2005中的架构(Schema)、用户(User)、登录(Login)和角色(Role)
- Sql Server 2005中的架构(Schema)、用户(User)、登录(Login)和角色(Role)(一)
- Sql Server 2005中的架构(Schema)、用户(User)、登录(Login)和角色(Role)
- Drupal7的User Login用户登录教程
- struts2开发_userlogin_模拟用户登录
- Sql Server 2005中的架构(Schema)、用户(User)、登录(Login)和角色(Role)(二)
- Sql Server 2005中的架构(Schema)、用户(User)、登录(Login)和角色(Role)
- Sql Server 2005中的架构(Schema)、用户(User)、角色(Role)和登录(Login)一
- Sql Server 2005中的架构(Schema)、用户(User)、角色(Role)和登录(Login)(三)
- Sql Server 2005中的架构(Schema)、用户(User)、角色(Role)和登录(Login)(一)
- (zz)Sql Server 2005中的架构(Schema)、用户(User)、角色(Role)和登录(Login)(一)