getConfig()['defaultLoginRedirectPage']; if(array_key_exists('lastPage', $_SESSION)) { redirect($_SESSION('lastPage')); } else { redirect($defaultPage); } } $login = $container->getLogin(); if($login->isLoggedIn()) { doRedirect(); } $errors = array(); if($_SERVER['REQUEST_METHOD'] === 'POST') { $username = getPostVariable("username"); $password = getPostVariable("password"); if(empty($username)) { $errors['username'] = "Please enter a Username."; } if(empty($password)) { $errors['password'] = "Please enter a Password."; } if(!empty($username) && !empty($password)) { if($login->login($username, $password)) { $container->setNotice("Success! You have been successfully logged in."); doRedirect(); } else { $errors['login'] = "Invalid credentials. Please check your username and password, and try again."; } } } $values = array(); $values['errors'] = $errors; $container->setTitle("Login"); $container->render("login.html.php", $values);