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 static function select($name, $list = array(), $selected = null, $title = "", $show_key_name = 'name', $show_pk_name = 'id') { $default[] = "<option value='0' selected>-请选择{$title}-</option>"; if ($selected === null) { if (isset($_REQUEST[$name]) && $_REQUEST[$name]) { $selected = RequestParam::Request($name); } elseif (Session::Exists(SESSION_LAST_POST)) { $last_post = Session::Get(SESSION_LAST_POST); $selected = array_get($last_post, $name); } } if (!empty($list)) { foreach ($list as $one) { $selectedStyle = $one[$show_pk_name] == $selected ? 'selected' : ''; $default[] = sprintf('<option value="%s" %s>%s</option>', $one[$show_pk_name], $selectedStyle, $one[$show_key_name]); } } return join('', $default); }
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); }