On Thursday 28 November 2002 01:51, Jesús Pérez wrote: > Hi, > > 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?
If the cases are as simple as the examples above then you can just use string comparison functions. Something like: if (strstr($USER_IP, '192.168.0.')) { do_something(); ... -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* A memorandum is written not to inform the reader, but to protect the writer. -- Dean Acheson */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php