Code: Select all
function setCaptcha(){
if (request.readyState == 4){
	if (request.status == 200){
        responseXml = request.responseXML;
        xmlDoc = responseXml.documentElement;
        action = xmlDoc.getElementsByTagName("action")[0].firstChild.data;
		alert(action);
        if (action == 'ok'){
			b=true;
		}else{
			b=false;
			alert('Error!');
		}
    }
  }
}
url = "../php/get_captcha.php?cap="+m5ce14fbrp_captcha_phrase.value;
//		alert(url);
		createRequest();
		request.open("GET", url, false);
		request.onreadystatechange = function() {setCaptcha();};
		request.send(null);Code: Select all
require '../include.php'; // (from site's root )
$cap=$_GET['cap'];
$captcha = &$gCms->getModuleInstance('Captcha');
if(is_object($captcha)){
$validated=$captcha->CheckCaptcha($cap);
if($validated==true)
	$response = '<?xml version="1.0" encoding="utf8" standalone="yes"?><response><action>ok</action></response>';
else $response = '<?xml version="1.0" encoding="utf8" standalone="yes"?><response><action>bad</action></response>';
} else $response = '<?xml version="1.0" encoding="utf8" standalone="yes"?><response><action>no object</action></response>';
header('Content-Type: text/xml');
echo $response;


