<?php
session_start();
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    header("Location: login.html");
    exit();
}
?>

<!DOCTYPE html>
<html>

<head>
    <title>Verify OTP</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="main.css">
</head>

<body class="verifyotp_php">

    <div class="otp-container">
        <h2>Enter OTP</h2>
        <form method="post" action="check_otp.php">
            <input type="number" name="otp" placeholder="6-digit OTP" required min="100000" max="999999" />
            <button type="submit">Verify</button>
        </form>
        <div class="message" id="messageBox">
            <?php
            if (isset($_SESSION['otp_error'])) {
                echo htmlspecialchars($_SESSION['otp_error']);
                unset($_SESSION['otp_error']);
            }
            ?>
        </div>
    </div>

</body>

</html>