$session->message(); } if ($session->isLoggedIn()) { redirect_to("app/index.php"); } if (isset($_POST['submit'])) { $username = $_POST['username']; $password = $_POST['password']; if (empty($username) || empty($password)) { $err = "Username or password cannot be empty"; } else { $found = User::authenticate($username, $password); if ($found) { $session->login($found, $ac); $session->message("Welcome {$username}"); $session->sessionVar("user", "You are logged in as {$username}"); redirect_to("app/index.php"); } else { $err = "Username and/or password is incorrect. Please try again"; } } } else { // Form not submitted $msg = ""; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>App Real Estate</title>