Finding an IP addx

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
cto1mac
Forum Commoner
Posts: 54
Joined: Tue Jan 27, 2004 6:11 am
Location: Virginia Beach, VA

Finding an IP addx

Post 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??
User avatar
Saethyr
Forum Contributor
Posts: 182
Joined: Thu Sep 25, 2003 9:21 am
Location: Wichita, Kansas USA
Contact:

Post 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.

?>
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

but its not entirely secure!
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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.
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post 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...
Post Reply