/** *@Decription : user login * *@Param : user name *@Param : password * *@return: int (0: success; 1:user not exists; 2:password wrong) */ public function login($username, $password) { if (($userInfo = $this->getUserByName($username)) === false) { return 1; } if ($userInfo['pwd'] !== My_Kernel::encryptString($password)) { return 2; } //load user information into session $this->_initUserSession($userInfo); return 0; }