isSetupCompleted()) { header("Location: setup.php"); exit(); } // Redirect if already logged in if ($auth->isLoggedIn()) { header("Location: index.php"); exit(); } $error_message = ''; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $username = trim($_POST['username'] ?? ''); $password = $_POST['password'] ?? ''; if (empty($username) || empty($password)) { $error_message = 'Please enter both username and password.'; } else { if ($auth->login($username, $password)) { header("Location: index.php"); exit(); } else { $error_message = 'Invalid username or password.'; } } } $page_title = 'Login'; ?>
Fish Business Management System