/** * 登陆方法 * * @param unknown $username 用户名 * @param unknown $pwd 密码 */ public static function Login($username, $pwd) { $user = Lib_User::Fetch($username, 'username'); if (!$user) { System::AddError("用户名错误"); return false; } if ($user['password'] != self::EncodePWD($pwd)) { System::AddError("密码错误"); return false; } Lib_User::SaveUser($user); return $user; }
public function excute() { $post = RequestParam::Post(); if ($post) { $username = $post['username']; $pwd = $post['pwd']; $result = Lib_User::Register($username, $pwd); if ($result) { System::AddNotice("注册成功"); Utility::Redirect("/demo/list"); } } $param = array('username' => $username); $this->show($param); }
public function excute() { $loginUser = Lib_User::GetLoginUser(); if ($loginUser) { Utility::Redirect("/demo/list"); } $post = RequestParam::Post(); if ($post) { $username = $post['username']; $pwd = $post['pwd']; $loginUser = Lib_User::Login($username, $pwd); if ($loginUser) { System::AddNotice("登陆成功"); Utility::Redirect("/demo/list"); } } $param = array(); $this->show($param); }
public function excute() { $loginUser = Lib_User::NeedLogin(); $pageSize = 20; $searchUser = new Search_User(); $count = $searchUser->getCount(); $pageInfo = Page::GetPageInfo($pageSize, $count); $searchUser->size = $pageSize; $searchUser->offset = $pageInfo['offset']; $users = $searchUser->getList(); foreach ($users as $index => $user) { $user['create_date'] = date('Y-m-d H:i:s', $user['create_time']); $user['login_date'] = date('Y-m-d H:i:s', $user['login_time']); $users[$index] = $user; } $tableObj = new Html_Table($users); $keyMap = array('id' => '用户ID', 'username' => '用户名', 'create_date' => '注册时间', 'register_ip' => '注册IP', 'login_date' => '最后登陆时间', 'login_ip' => '最后登录IP'); $tableObj->setTableInfo($keyMap); $tableHtml = $tableObj->createHtml(); $param = array('loginUser' => $loginUser, 'tableHtml' => $tableHtml, 'pageStr' => $pageInfo['page_str']); $this->show($param); }
public function getLoginUser() { $loginUser = Lib_User::GetLoginUser(); return $loginUser; }
public function excute() { Lib_User::ClearUser(); Utility::Redirect('/'); }
public function __construct(\Core\Application $application) { if ($application->passport && $application->passport->is_auth()) { self::$userID = $application->passport->getUserID(); } }