Kindly enter the required details below.
$inResult = 0; $passed = 0; function startElement($parser, $name, $attrs) { global $inResult; $inResult = ($name=="RESULT"); } function endElement($name) { global $inResult; $inResult = 0; } function characterData($parer, $data) { global $inResult; global $passed; if ($inResult && $data == "Pass") { $passed = 1; } } //PHP function to actually validate the captcha server side, so first is to get the ticket from the POST, then connect to Asirra server using CURL. //Once the response has been received, it will be used to check whether the validation succeeded or not. function ValidateAsirraChallenge() { global $passed; $AsirraServiceUrl = "http://challenge.asirra.com/cgi/Asirra"; $ticket = $_POST['Asirra_Ticket']; $url = $AsirraServiceUrl."?action=ValidateTicket&ticket=".$ticket; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); $resultXml = curl_exec($ch); curl_close($ch); $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); xml_parse($xml_parser, $resultXml, 1); xml_parser_free($xml_parser); if (!$passed) { die("Asirra validation failed!"); } } ValidateAsirraChallenge(); //##################### END asirra code block FIVE #####################--> //Now that the captcha validation has been successful, process the rest of the PHP form processing script. echo ''; echo ''; echo "Hi ".htmlspecialchars($_POST['UserName'])."! Since you read this page, you are really a human and NOT a robot!";
echo "And your favorite food is ".htmlspecialchars($_POST['FavoriteFood']).".";
echo '
';
echo 'You may take this again.';
}
?>