I need to check if the users IP is within two IP ranges, how can I do this?
I was thinking that some kind of function that either returned 1 or 0 depending if the IP is within one of the ranges would be in order, but don't know how to go about doing that
Example:
The two defined IP ranges are 10.0.0.1 -> 10.0.0.255 and 192.168.0.1 -> 192.168.0.255
If the visitors IP was 192.168.0.54 the function would return 1
If the visitors IP was 10.0.0.122 the function would return 1
If the visitors IP was 69.56.28.144 the function would return 0
(or the opposite way round, I'm easy
Hopefully you understand what I'm trying to do.
Any guidence or complete function would be appreciated.