userModel = new UserModel(); $this->view = $view; } public function loginUser() { $erg = array(); $erg = $this->userModel->loginUser($_POST["username"], $_POST["password"]); if ($erg["success"] == true) { header("Location: ?controller=Welcome&do=showWelcome"); exit(); } else { $this->view->setDoMethodName("showUserLoginForm"); $this->showUserLoginForm(); } } public function logoutUser() { $this->userModel->logoutUser(); header("Location: ?controller=User&do=showUserLoginForm"); exit(); } public function registerUser() { $erg = array(); $erg = $this->userModel->registerUser($_POST["username"], $_POST["password"]); if ($erg["success"] == true) { header("Location: ?controller=User&do=showUserLoginForm"); exit(); } else { $this->view->setDoMethodName("showUserRegisterForm"); $message = $erg['message']; echo ""; $this->view->setVars([ "errmsg" => $erg["message"] ]); $this->showUserRegisterForm(); } } public function showUserLoginForm() { } public function showUserRegisterForm() { } }