DISCUZ Login Process Analysis, the recent research, ucenter synchronous landing mechanism, the first from the Discuz login started
1.form form Submission member.php?mod=logging&action=login&loginsubmit=yes&handlekey=login&loginhash=lm137 &inajax=1
Processing Scripts source/module/member/member_logging.php
$ctl _obj = new Logging_ctl ()//Initialize Login object, Source\class\class_member.php=>class logging_ctl $ctl _obj->setting = $_G [' Setting ']; $method = ' on_ '. $_get[' action '];//$method = ' on_login '; $ctl _obj->template = ' member/login '; $ctl _obj-> $method ();//Call Source\class\class_member.php=>on_login () On_ to source\class\class_member.php below Login for Analysis
The 2.source\class\class_member.php on_login function is too long to post only its core part, which is also the core function in the login process, through Userlogin (uc_client\control\user.php) Data analysis, and the return results $result analysis and processing, return results $result[' status ']>0, display login success, setloginstatus login status record
$result = userlogin ($_get[' username '], $_get[' password '], $_get[' QuestionID '], $_get[' answer '], $this->setting[' Autoidselect ']? ' Auto ': $_get[' Loginfield '], $_g[' ClientIP ');//95 to the core handler function, Userlogin to uc_client\client.php//according to $result[' Status '] return value for processing if ($result [' status '] > 0)//when $result[' status ']>0, Setloginstatus for landing ($result [' member '], $_get[' cookietime '] ? 2.592 million:0)//Log login status, complete the login action to face the uc_client\client.php uc_user_login analysis
3.uc_client\client.php
function Uc_user_login Call the Onlogin function of uc_client\control\user.php via Call_user_func
function Uc_user_login ($username, $password, $isuid = 0, $checkques = 0, $questionid = ', $answer = ', $ip = ') {$isu id = intval ($isuid); $return = Call_user_func (uc_api_func, ' user ', ' login ', array (' username ' => $username, ' password ' => $password, ' Isuid ' => $isuid, ' checkques ' => $checkques, ' QuestionID ' => $questionid, ' answer ' => $answer, ' IP ' => $ip) //uc_api_func= Uc_api_mysql, call Uc_api_mysql by Call_user_func callback, pass parameters, and introduce Uc_api_mysql by uc_client\control\ User.php's Onlogin function return uc_connect = = ' MySQL '? $return: Uc_unserialize ($return); } ... function Uc_api_mysql ($model, $action, $args =array ()) {global $uc _controls; if (Empty ($uc _). \ n controls[$model])) {if (Function_exists ("mysql_connect")) {include_once uc_root. /lib/db.class.php '; else {include_once uc_root. '. /lib/dbi.class.php '; } include_once uc_root. '. /model/base.php '; Include_once uc_root. ". /control/$model. php ";//Introduce uc_client\control\user.php eval (" \ $uc _controls[' $model '] = new {$model}control (); "); } if ($action {0}!= ' _ ') {