From 82769165658074feb6409cd59aab7505fb319c61 Mon Sep 17 00:00:00 2001 From: "ctrlaltca@gmail.com" <> Date: Mon, 23 Jan 2012 08:31:20 +0000 Subject: little improvement to TReCaptcha; refs #345, patch by gabor --- framework/Web/UI/WebControls/TReCaptcha.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'framework') diff --git a/framework/Web/UI/WebControls/TReCaptcha.php b/framework/Web/UI/WebControls/TReCaptcha.php index 50886276..b9ba0070 100644 --- a/framework/Web/UI/WebControls/TReCaptcha.php +++ b/framework/Web/UI/WebControls/TReCaptcha.php @@ -159,11 +159,20 @@ class TReCaptcha extends TWebControl implements IValidatable public function validate() { + if (! + ( + ($challenge = @$_POST[$this->getChallengeFieldName()]) + and + ($response = @$_POST[$this->getResponseFieldName()]) + ) + ) + return false; + $resp = recaptcha_check_answer( $this->getPrivateKey(), $_SERVER["REMOTE_ADDR"], - $_POST[$this->getChallengeFieldName()], - $_POST[$this->getResponseFieldName()] + $challenge, + $response ); return ($resp->is_valid==1); } -- cgit v1.2.3