Page 1 of 1

Finding an IP addx

Posted: Mon Apr 19, 2004 11:07 am
by cto1mac
Is it possible to get the IP address from a requesting box so that you can do content control on a php site??

ie.
if a box is comming from the 14.1.1.x network, then they can get to certain areas but if they come from any other network they can only get to one area on my site??

Posted: Mon Apr 19, 2004 11:18 am
by Saethyr
should be able to use

Code: Select all

$_SERVER['REMOTE_ADDR']

to get the address they are viewing from, then you can just do a check againts your ranges.

?>

Posted: Mon Apr 19, 2004 11:21 am
by magicrobotmonkey
but its not entirely secure!

Posted: Mon Apr 19, 2004 1:30 pm
by JAM
magicrobotmonkey wrote:but its not entirely secure!
If you feel that this isn't entirely secure enough (is anything?), why not combine it with login/pass checks.

[php_man]gethostbyaddr[/php_man] might have more tweaks on the subject.

Posted: Mon Apr 19, 2004 1:32 pm
by magicrobotmonkey
Yea combined its better, but alone, the only situation i would rely on it would be on an intranet where things were subtnetworked or something...