0) { return true; // OTP verified successfully } else { return false; // Invalid OTP for the given email } } // API endpoint to verify OTP and email if (!empty($_POST['email']) && !empty($_POST['otp'])) { $email = $_POST['email']; $otp = $_POST['otp']; // Verify OTP and email $otpVerified = verifyOTP($email, $otp); if ($otpVerified) { echo "OTP verified successfully"; } else { echo "Invalid OTP for the given email"; } } else { echo "Email and OTP are required"; }