Jump to content


Photo

Script access from 3 IPs (only)


  • Please log in to reply
6 replies to this topic

#1 StirCrazy

StirCrazy
  • Members
  • PipPipPip
  • Advanced Member
  • 75 posts

Posted 19 July 2006 - 01:32 PM

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>

#2 designationlocutus

designationlocutus
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts

Posted 19 July 2006 - 01:35 PM

Have a look here, might save you some time :)

http://codex.wordpre.../Denying_Access

#3 StirCrazy

StirCrazy
  • Members
  • PipPipPip
  • Advanced Member
  • 75 posts

Posted 19 July 2006 - 01:45 PM

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>

#4 designationlocutus

designationlocutus
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts

Posted 19 July 2006 - 01:49 PM

Are your three IP's within the same network?

#5 StirCrazy

StirCrazy
  • Members
  • PipPipPip
  • Advanced Member
  • 75 posts

Posted 19 July 2006 - 01:54 PM

nope ~ 3 different countries.

S.C>

#6 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 19 July 2006 - 01:59 PM

$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();
}


#7 StirCrazy

StirCrazy
  • Members
  • PipPipPip
  • Advanced Member
  • 75 posts

Posted 19 July 2006 - 02:16 PM

Your a good man thorpe (you are a man rite?)

Thanks for your help both of you.


S.C>




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users