<?php
// Start the session to access and manage session variables (e.g., error messages)
session_start();
?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8"> <!-- Set character encoding -->
    <title>Forgot Password</title> <!-- Title of the page -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Make page responsive -->
    <link rel="stylesheet" href="main.css">
</head>

<body class="forgot_password">
    <button id="back-button" onclick="history.back();">Go back</button>
    <!-- Main container for Forgot Password UI -->
    <div class="forgot-container">
        <h2>Forgot Password</h2>

        <!-- Form that submits user input to send_otp2.php using POST method -->
        <form method="post" action="send_otp2.php">
            <label>Enter Username or Email:</label>
            <input type="text" name="identifier" required placeholder="example@domain.com or Username" />
            <button type="submit">Send OTP</button> <!-- Submit button to trigger OTP send -->
        </form>

        <!-- Message box to display error messages from the session -->
        <div class="message" id="messageBox">
            <?php
            // Check if an error message is stored in session and display it
            if (isset($_SESSION['error_message'])) {
                echo htmlspecialchars($_SESSION['error_message']); // Display safely
                unset($_SESSION['error_message']); // Remove message after displaying once
            }
            ?>
        </div>

    </div>

</body>

</html>
