"; echo "

$title

"; echo "

$message

"; echo "
"; } // Function to display the subscription form function showForm($message = '') { echo "
"; if ($message) { echo "

$message

"; } echo '
'; echo '
'; echo ''; echo '
'; echo ''; echo '
'; echo "
"; } // Function to display thank you message function showThankYouMessage() { showHeaderMessage("The Future Awaits: Join the Gravitrek Voyage", "Your subscription to the Gravitrek Odyssey is confirmed. Together, let's embark on this journey to defy fate, forging a new destiny for humanity in the celestial expanse of Neterios. Embrace this chance to become part of an epic saga of survival, discovery, and new beginnings."); } // Database and form submission handling $servername = "localhost"; $username = "graviweb"; $password = "gravipass"; $dbname = "gravitrek"; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['email'])) { $email = $conn->real_escape_string($_POST['email']); $sql = "SELECT * FROM waitinglist WHERE email = '$email'"; $result = $conn->query($sql); if ($result->num_rows > 0) { showHeaderMessage("Already Subscribed", "You are already on the waiting list."); } else { $sql = "INSERT INTO waitinglist (email) VALUES ('$email')"; if ($conn->query($sql) === TRUE) { showThankYouMessage(); } else { showHeaderMessage("Error Occurred", "Error: " . $conn->error); } } } else { showHeaderMessage("Join the Gravitrek Launch", "We're thrilled to have you onboard this magnificent journey. Step aboard the Gravitrek platform and be part of a pioneering community aiming for the stars. Your journey towards the vastness of Neterios begins with a single click."); showForm(); // Show the form by default if not POST method } $conn->close(); echo ""; include 'footer.php'; ?>