
­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
<?php
session_start();

if ($_SERVER["REQUEST_METHOD"] === "POST") {
    $enteredOtp = $_POST['otp'] ?? '';

    if (isset($_SESSION['otp']) && $enteredOtp == $_SESSION['otp']) {
        echo "success"; // OTP verified successfully
        unset($_SESSION['otp']); // Clear OTP after successful verification
    } else {
        echo "error"; // Incorrect OTP
    }
} else {
    echo "invalid"; // Invalid request method
}
?>