|
@@ 154-159 (lines=6) @@
|
| 151 |
|
*/ |
| 152 |
|
function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array()) |
| 153 |
|
{ |
| 154 |
|
if ($privkey == null || $privkey == '') { |
| 155 |
|
$recaptcha_response = new ReCaptchaResponse(); |
| 156 |
|
$recaptcha_response->is_valid = false; |
| 157 |
|
$recaptcha_response->error = 'To use reCAPTCHA you must get an API key from <a href=\'https://www.google.com/recaptcha/admin/create\'>https://www.google.com/recaptcha/admin/create</a>'; |
| 158 |
|
return $recaptcha_response; |
| 159 |
|
} |
| 160 |
|
|
| 161 |
|
if ($remoteip == null || $remoteip == '') { |
| 162 |
|
$recaptcha_response = new ReCaptchaResponse(); |
|
@@ 161-166 (lines=6) @@
|
| 158 |
|
return $recaptcha_response; |
| 159 |
|
} |
| 160 |
|
|
| 161 |
|
if ($remoteip == null || $remoteip == '') { |
| 162 |
|
$recaptcha_response = new ReCaptchaResponse(); |
| 163 |
|
$recaptcha_response->is_valid = false; |
| 164 |
|
$recaptcha_response->error = 'For security reasons, you must pass the remote ip to reCAPTCHA'; |
| 165 |
|
return $recaptcha_response; |
| 166 |
|
} |
| 167 |
|
|
| 168 |
|
//discard spam submissions |
| 169 |
|
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) { |