public function __construct() { $this->allow_redirect = true; $this->view = Das_View::getInstance($this->getDefaultFile()); $app_web_path = 'http://' . $_SERVER['SERVER_NAME'] . '' . $_SERVER['SCRIPT_NAME']; $app_web_path = strtolower($app_web_path); $app_web_path = str_replace("index.php", "", $app_web_path); $this->app_web_path = $app_web_path; $this->view->RES_PATH = $app_web_path; $dv = new Das_ViewUtil(); $this->view->dv = $dv; $login = new Das_Login(); $this->view->login = $login->getUserInfo(); $act = $this->getAction(); if (!isset($act) && $act == null) { $act = "index"; } $act = strtolower($act); $method = $act . "Action"; if (method_exists($this, $method)) { $this->{$method}(); } else { $this->indexAction(); } }
public function indexAction() { if ($this->isPost()) { $username = $_POST['username']; $password = $_POST['password']; $login = new Das_Login(); $login->login($username, $password); if ($login->checkLogin()) { //loginSuccess $info = $login->getUserInfo(); //echo "<pre>"; //var_dump($info); //die; $this->redirect("index"); } else { $this->view->isError = true; $this->view->error = "登录不成功"; } } $this->view->render("login.html"); }