login($password)) { // Redirect to a protected page if login is successful header("Location: index.php?login=success"); } else { // Redirect back to the login page with an error message header("Location: index.php?error=1"); } } ?>