Obsolite, Old question was like:
Is there a way to turn off the recaptcha, created using noscript? I used the standard example, but now I have to make it disappear for certain IPs. I know how to get the ip, but I have not figured out how to turn recaptcha off. I have a wild idea to use php(html) to spawn recaptca, so it can be "turned off" easily.
What it should have been:
I am trying to turn off recaptcha, created using noscript, standard example was taken.
Right now the general outline of the code is below, some parts are obviously missing
<?php
.......
require_once('IpChecker.php');
$in_range = check_ip($ip);
if(!$in_range)
{
if ($_POST["recaptcha_response_field"]){......}
.......
?>
.............
<?php
if(!$in_range)
{
echo recaptcha_get_html($publickey, $error);
}
?>
It does work correctly but I get an annoing php notice, which basically tells that recaptcha_response_field
required in the top part, only appears in the bottom part inside recaptcha_get_html($publickey, $error)
. I am mainly trying to get rid of annoing php notice.
UPDATE: I am a moron. Period. There should be a check if the request was a POST
at all - if ($_SERVER['REQUEST_METHOD'] === 'POST')
and then there should probably be a check if (isset($_POST["recaptcha_response_field"]))
Given my experience I now see that if ($_POST["recaptcha_response_field"])
is not really correct way to do things
$some_ips = array("127.0.0.1", "192.168.0.33");
if(! in_array($_SERVER['REMOTE_ADDR'], $some_ips)){
Your recaptcha stuff here...
}