On Monday, March 18, 2002, at 04:07  PM, Charles Williams wrote:

> The above a just a few examples.  I need to be able to grab either the 
> IP
> addresses or the ranges and verify that when an IP is entered at a later
> date and compared to the above types of previously saved data that the 
> IP is
> within the range(s).
> I hope I explained that ok. ;)
> So basically I guess I just need a way of, after retrieving the info 
> from
> the DB, splitting the IP (range(s)) apart and then comparing the IP 
> entered
> to those in the array(?) to verify that it was a good entry.

I would store the IP number into four separate columns in a database 
table, one column for each part of the IP.  This is just to be safe, 
really you only need two (one for the domain and subnet numbers, and the 
last for the machine number) but if you ever needed to cross subnets 
then you'd be glad you had set up your data in this flexible way.  Use 
explode(".", $ip_input) to split the parts and then insert them into the 
database.  Then just test to see if the machine number is between two 
given machine numbers and that the domain + subnet numbers are the same 
as the database domain + subnet numbers.



Erik Price
Web Developer Temp
Media Lab, H.H. Brown

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to