Jump to content

Archived

This topic is now archived and is closed to further replies.

StirCrazy

Script access from 3 IPs (only)

Recommended Posts

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 Guys

S.C>

Share this post


Link to post
Share on other sites
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>

Share this post


Link to post
Share on other sites
[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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.