discuz X3使用者登入uc_user_login()函數詳解

來源:互聯網
上載者:User

discuz X3使用者登入uc_user_login()函數詳解


驗證使用者登入 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 使用者名稱 / 使用者識別碼
string password 密碼
bool isuid 是否使用使用者識別碼登入
1:使用使用者識別碼登入
0:(預設值) 使用使用者名稱登入
bool checkques 是否驗證安裝提問
1:驗證安全提問
0:(預設值) 不驗證安全提問
integer questionid 安全提問索引
string answer 安全提問答案
傳回值
含義
array integer [0] 大於 0:返回使用者識別碼,表示使用者登入成功
-1:使用者不存在,或者被刪除
-2:密碼錯
-3:安全提問錯
string [1] 使用者名稱
string [2] 密碼
string [3] Email
bool [4] 使用者名稱是否重名

本介面函數用於使用者的登入驗證,使用者名稱及密碼正確無誤則返回使用者在 UCenter 的基本資料,否則返回相應的錯誤資訊。如果應用程式是升級過來的,並且當前登入使用者和已有使用者重名,那麼返回的數組中 [4] 的值將返回 1。



附加擷取使用者資料方法:uc_get_user()

擷取使用者資料: array uc_get_user( string username, bool isuid)函數參數
參數 含義
string username 使用者名稱
bool isuid 是否使用使用者識別碼擷取
1:使用使用者識別碼擷取
0:(預設值) 使用使用者名稱擷取
傳回值
含義
array integer [0] 使用者識別碼
string [1] 使用者名稱
string [2] Email

本介面函數用於擷取使用者在 UCenter 的基本資料,如使用者不存在,傳回值為 integer 的數值 0。




本文出自 “PHPer許琴-專註於PHP技術” 部落格,請務必保留此出處http://xuqin.blog.51cto.com/5183168/1293562

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.