logout(); } else if (isset($_POST['login'])){ if(isset($_POST['username']) && isset($_POST['password']) && !empty($_POST['username']) && !empty($_POST['password'])){ $username = $_POST['username']; $password = $_POST['password']; if($user->login($username, $password)){ header("Location: /"); die(); } else { $error = "Incorrect username or password."; } } else { $error = "Must fill in both username and password."; } } $header = new Header("Login Required"); $header->addStyle("/styles/style.css"); $header->setAttribute('title', 'Michigan Flyers'); $header->setAttribute('tagline', '2022 Online Ballot'); $header->output(); ?>