Hi ogun, and thanks for the quick reply!
At first i also thought that the php isn't validating properly but if i manually enter the values it doesn't pass unless the captcha is correct.
Here is how reCaptcha is implemented.
The form in product.tpl:
Code: Select all
<?php
require_once('system/library/recaptchalib.php');
$publickey = "changed this with my public key";
echo recaptcha_get_html($publickey);
?>
Here is the validation function in /catalog/controller/product/product.php
I've stripped everything to the bone and just log if the captcha validation was passed or not, and the POSTarray.
Code: Select all
<?php
private function validation() {
require_once('system/library/recaptchalib.php');
$privatekey = "my private key here";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
$log_text = 'Failed captcha validation: ';
} else {
// Your code here to handle a successful verification
$log_text = 'CAPTCHA VALIDATION SUCCESSFUL: ';
}
//log
$this->load->library('log');
foreach ($this->request->post as $k=>$v)
{
$log_text .= $k. '=>' .$v. ',';
}
$log = new Log('spam.txt');
$log->write($log_text);
return TRUE;
}
?>
And this is what i get in the log file:
2014-01-15 12:49:25 - CAPTCHA VALIDATION SUCCESSFUL:
fax=>jvILLp95,
oras=>xTI97FYv03Y,
observatii=>Acabei de enviar um permriio e-mail para todos os incritos no curso ate9 agora. Se vocea ne3o recebeu o email, me avise (por aqui ou por email ),
telefon=>Kjpt2xGwOe,
nume=>Oynn2lxO45M8,
email=>
wstewart@idahofallszoo.org,
compania=>dmhB1x4S,
recaptcha_response_field=>manual_challenge,
recaptcha_challenge_field=>03AHJ_VuszJKbmyVpIrSwQhoJWZeLLc8g7uNdox2XLAVMPj9wD9SdxHBmuluxRjEzldpk_hDxNu7Zz0AMRwCF34WbdpBh6zArzpjDWCz0yE0zRWEqSk954p3AXSJG3MdOvLCpqABc1sUSJ1kSDA7nFk2gLvbTmoXxtvA,
You can see that captcha was passed, but still the recaptcha_response_field says manual_challenge. This is where the actual text from captcha should be. If i manually enter, recaptcha_response_field gets what i enter....
Thanks again for the time, I'm trying the hidden captcha solution now.