StirCrazy Posted July 19, 2006 Share Posted July 19, 2006 I have a script that needs to be receive data from 3 possible IP address.At the moment it's only geared up to use one IP (using below)if(strncmp("111.111.111.1", $_SERVER["REMOTE_ADDR"], 10) != 0){How would I change this to 3 different IPs?Thanks GuysS.C> Quote Link to comment https://forums.phpfreaks.com/topic/15035-script-access-from-3-ips-only/ Share on other sites More sharing options...
designationlocutus Posted July 19, 2006 Share Posted July 19, 2006 Have a look here, might save you some time :)http://codex.wordpress.org/Combating_Comment_Spam/Denying_Access Quote Link to comment https://forums.phpfreaks.com/topic/15035-script-access-from-3-ips-only/#findComment-60449 Share on other sites More sharing options...
StirCrazy Posted July 19, 2006 Author Share Posted July 19, 2006 Thanks for that designationlocutus ~ that does answer another question I had, but that's more .htaccess and how to block 1 or 2 IPs in PHP. I want to block all IPs apart from 3 in PHP.S.C> Quote Link to comment https://forums.phpfreaks.com/topic/15035-script-access-from-3-ips-only/#findComment-60453 Share on other sites More sharing options...
designationlocutus Posted July 19, 2006 Share Posted July 19, 2006 Are your three IP's within the same network? Quote Link to comment https://forums.phpfreaks.com/topic/15035-script-access-from-3-ips-only/#findComment-60456 Share on other sites More sharing options...
StirCrazy Posted July 19, 2006 Author Share Posted July 19, 2006 nope ~ 3 different countries.S.C> Quote Link to comment https://forums.phpfreaks.com/topic/15035-script-access-from-3-ips-only/#findComment-60459 Share on other sites More sharing options...
trq Posted July 19, 2006 Share Posted July 19, 2006 [code=php:0]$ips = array('111.111.111.111','222.222.222.222','333.333.333.333');if (!in_array($_SERVER['REMOTE_ADDR'],$ips)) { echo "sorry... you are not permitted here"; exit();}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/15035-script-access-from-3-ips-only/#findComment-60462 Share on other sites More sharing options...
StirCrazy Posted July 19, 2006 Author Share Posted July 19, 2006 Your a good man thorpe (you are a man rite?)Thanks for your help both of you.S.C> Quote Link to comment https://forums.phpfreaks.com/topic/15035-script-access-from-3-ips-only/#findComment-60473 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.