• Hi

    Just discover you plugin after testing a ton of others captcha plugin and it looks like very cool πŸ™‚

    But what about a whitelist option? Or maybe you can give us a little php snipet that can do the trick?

    Something like:

    if(isset($_SERVER['REMOTE_ADDR'])) {
      	$My_Remote_ip = $_SERVER['REMOTE_ADDR'];
    	if ($My_Remote_ip != 'XXX.XXX.XXX.XXX') {
    		define('XRVEL_LOGIN_RECAPTCHA_ENABLED', true);
    	} else {
    		define('XRVEL_LOGIN_RECAPTCHA_ENABLED', false);
    	}
    }

    or the one below if using a proxy:

    if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
      	$Zxffaddrs = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
      	$My_Remote_ip = $Zxffaddrs[0];
    	if ($My_Remote_ip != 'XXX.XXX.XXX.XXX') {
    		define('XRVEL_LOGIN_RECAPTCHA_ENABLED', true);
    	} else {
    		define('XRVEL_LOGIN_RECAPTCHA_ENABLED', false);
    	}
    }

    Those code are the one I’m using with another WP Google reCaptcha, so they are just exemples.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter pako69

    (@pako69)

    I had this below in your invisible-recaptcha.php and it works, but it will be better to have an option in your settings πŸ™‚

    if ( ! is_admin() ) {
    if(isset($_SERVER['REMOTE_ADDR'])) {
      	$My_Remote_ip = $_SERVER['REMOTE_ADDR'];
    	if ($My_Remote_ip == 'XXX.XXX.XXX.XXX') {
    		return;
    	} 
    }
    if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
      	$Zxffaddrs = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
      	$My_Remote_ip = $Zxffaddrs[0];
    	if ($My_Remote_ip != 'XXX.XXX.XXX.XXX') {
    		return;
    	}
    }
    }
    Plugin Author MihChe

    (@mihche)

    Hi @pako69,
    Basically you want to disable protection based on some IPs? Let me understand what you’d like to accomplish and I’ll help you with this.

    ~Mihai

    Thread Starter pako69

    (@pako69)

    Hi @mihche
    Basically you want to disable protection based on some IPs?
    Yes… πŸ™‚ and behind or not a proxy
    Thanks

    Hi. I’d also love to see this as an option. Like setting a list of host names (don’t have a static IP) for which the Captcha is omitted altogether. For illustration, is_whitelisted in the quick’n’dirty example would determine if the Captcha should be used or not. Anything like that in the works yet? πŸ™‚

    $whitelisthosts[] = 'dyn.example.com';
    $whitelisthosts[] = 'dyn.example.net';
    
    function is_whitelisted()
    {
    	global $whitelisthosts;
    	$ip = $_SERVER['REMOTE_ADDR'];
    	foreach ($whitelisthosts as $whitelisthost)
    	{
    		if ($ip == gethostbyname($whitelisthost))
    		{
    			return true;
    		}
    	}
    	return false;
    }

    While the global array should rather be built from a list specified on the options page.

    • This reply was modified 8 years, 9 months ago by motivmedia.
    • This reply was modified 8 years, 9 months ago by motivmedia.
    • This reply was modified 8 years, 9 months ago by motivmedia.
    • This reply was modified 8 years, 9 months ago by motivmedia. Reason: Couldn't get the code displayed correctly
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Whitelist?’ is closed to new replies.