Google
Edit File: verify_captcha.php
<?php session_start(); header('Content-Type: application/json; charset=utf-8'); function respond($status, $message = ''){ echo json_encode(["status"=>$status, "message"=>$message]); exit; } if(empty($_SESSION['captcha']) || empty($_SESSION['captcha_time'])){ respond("error", "Captcha expired. Refresh it."); } if(time() - $_SESSION['captcha_time'] > 300){ unset($_SESSION['captcha'], $_SESSION['captcha_time']); respond("error", "Captcha expired. Refresh it."); } $userCaptcha = strtoupper(trim($_POST['txtverifycaptcha'] ?? '')); if($userCaptcha !== $_SESSION['captcha']){ respond("error", "Invalid captcha."); } respond("success", "Captcha OK");