public function GetValidationResult() { if (is_null($this->Captcha)) { LBD_HttpHelper::BadRequest('captcha'); } // identifier of the particular Captcha object instance $instanceId = $this->GetInstanceId(); if (is_null($instanceId)) { LBD_HttpHelper::BadRequest('instance'); } $mimeType = 'application/json'; $this->output->set_content_type($mimeType); // JSON-encoded validation result $result = $this->Captcha->AjaxValidate($userInput, $instanceId); $this->Captcha->CaptchaBase->Save(); $resultJson = $this->GetJsonValidationResult($result); return $resultJson; }
function GetValidationResult() { // saved data for the specified Captcha object in the application $captcha = GetCaptchaObject(); if (is_null($captcha)) { LBD_HttpHelper::BadRequest('captcha'); } // identifier of the particular Captcha object instance $instanceId = GetInstanceId(); if (is_null($instanceId)) { LBD_HttpHelper::BadRequest('instance'); } // code to validate $userInput = GetUserInput(); while (ob_get_length()) { ob_end_clean(); } ob_start(); try { // response MIME type & headers header('Content-Type: text/javascript'); header('X-Robots-Tag: noindex, nofollow, noarchive, nosnippet'); // JSON-encoded validation result $result = false; if (isset($userInput) && isset($instanceId)) { $result = $captcha->Validate($userInput, $instanceId, LBD_ValidationAttemptOrigin::Client); $captcha->Save(); } $resultJson = GetJsonValidationResult($result); echo $resultJson; } catch (Exception $e) { header('Content-Type: text/plain'); echo $e->getMessage(); } ob_end_flush(); exit; }
function GetValidationResult() { // saved data for the specified Captcha object in the application $captcha = GetCaptchaObject(); if (is_null($captcha)) { LBD_HttpHelper::BadRequest('captcha'); } // identifier of the particular Captcha object instance $instanceId = GetInstanceId(); if (is_null($instanceId)) { LBD_HttpHelper::BadRequest('instance'); } // code to validate $userInput = GetUserInput(); // response MIME type & headers header('Content-Type: text/javascript'); // JSON-encoded validation result $result = false; if (isset($userInput) && isset($instanceId)) { $result = $captcha->Validate($userInput, $instanceId, LBD_ValidationAttemptOrigin::Client); $captcha->Save(); } session_write_close(); $resultJson = GetJsonValidationResult($result); echo $resultJson; }
/** * The client requests the Captcha validation result (used for Ajax Captcha validation). * * @return json */ public function getValidationResult() { if (is_null($this->captcha)) { \LBD_HttpHelper::BadRequest('captcha'); } // identifier of the particular Captcha object instance $instanceId = $this->getInstanceId(); if (is_null($instanceId)) { \LBD_HttpHelper::BadRequest('instance'); } $mimeType = 'application/json'; header("Content-Type: {$mimeType}"); // code to validate $userInput = $this->getUserInput(); // JSON-encoded validation result $result = $this->captcha->AjaxValidate($userInput, $instanceId); $this->captcha->CaptchaBase->Save(); $resultJson = $this->getJsonValidationResult($result); return $resultJson; }