* CAuth Upon a successful authentication, `hd_login` handler will call `CSession::create(user_id)` to start a session. * CSession `create` handler will save a new token by user_id. `getTimeout` will called by `CSessionCheck`, which in turn gets called by `hd_preprocessor` `getTimeout` get `sess_start` from DB using session token. --------------------------------------------------------------------------------------------------------- SELECT `sess_start` FROM `tbl_user` WHERE (`sess_token` = 'mekliilatuvyhvtkszucrnguwdgklmpnnpuufjvakpzeymuowkbohzoekunjfoebujjyacfqgjsxbeezgtqanywkzngphcxjwotp') --------------------------------------------------------------------------------------------------------- Then updates `sess_start` --------------------------------------------------------------------------------------------------------- UPDATE `tbl_user` SET `sess_start` = '2023-04-29 23:54:23' WHERE (`sess_token` = 'mekliilatuvyhvtkszucrnguwdgklmpnnpuufjvakpzeymuowkbohzoekunjfoebujjyacfqgjsxbeezgtqanywkzngphcxjwotp') --------------------------------------------------------------------------------------------------------- `getTimeout` will call CUserInfo::setup(token) * CUserInfo `CUserInfo::setup` will load data from tbl_user. --------------------------------------------------------------------------------------------------------- SELECT * FROM `tbl_user` WHERE (`sess_token` = 'mekliilatuvyhvtkszucrnguwdgklmpnnpuufjvakpzeymuowkbohzoekunjfoebujjyacfqgjsxbeezgtqanywkzngphcxjwotp') --------------------------------------------------------------------------------------------------------- Then store it in self::$info and save it in `CPhpSess` also. * CUG CUG::isAdmin uses CUserInfo::get("b_admin") --------------------------------------------------------------------------------------------------------- public static function isAdmin(){ return(intval(CUserInfo::get("b_admin"))===1); } --------------------------------------------------------------------------------------------------------- * CPhpSess `CUserInfo::setup` will call `CPhpSess::setRect` to store userinfo. `CPhpSess::setRect` gets called every time a command is clicked on the side menu of the admin panel. * CAdmin `CAdmin::isAdmin()` use CPhpSess::get` to obtain the value of `b_admin` ========================================================================================================= CUG::isAdmin() vs CAdmin::isAdmin() --------------------------------------------------------------------------------------------------------- CUG::isAdmin() is used in the admin panel CAdmin::isAdmin() is used outside of the admin panel =========================================================================================================