summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TReCaptcha.php
diff options
context:
space:
mode:
authorctrlaltca@gmail.com <>2012-01-23 08:31:20 +0000
committerctrlaltca@gmail.com <>2012-01-23 08:31:20 +0000
commit82769165658074feb6409cd59aab7505fb319c61 (patch)
tree58e1ef8fce5074ad684eba72a047ac75dc53a10a /framework/Web/UI/WebControls/TReCaptcha.php
parenta26837b0990f65b7091263026296d2aff68d9838 (diff)
little improvement to TReCaptcha; refs #345, patch by gabor
Diffstat (limited to 'framework/Web/UI/WebControls/TReCaptcha.php')
-rw-r--r--framework/Web/UI/WebControls/TReCaptcha.php13
1 files changed, 11 insertions, 2 deletions
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);
}