Re: IPs comparing

From: Date: Wed, 27 Nov 2002 18:21:41 +0000
Subject: Re: IPs comparing
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-126323@lists.php.net to get a copy of this message
Hi Jesús, > I have several subnets in my network and want to show different webs > depending on the subnet the user was. > > I know how to get the IP but not how to compare two IPs numeracally, I mean: > > > If ((USER-IP > 192.168.0.1) && (USER-IP < 192.168.0.255)) > Else if ((USER-IP > 192.168.1.1) && (USER-IP < 192.168.1.255)) > ... > > What do you suggest me? I suggest treating them as strings, and use (IF) equality/switch statements to deliver the appropriate web... Regards, =dn

« previous php.general (#126323) next »