Re: [PHP] function to compare ip addr to a ip range>

2005-10-13 Thread Richard Lynch
On Thu, October 13, 2005 9:26 am, Bosky, Dave wrote: > Does anyone have a function that will check if an ip address falls > with > a starting/ending ip address range>> If you are using PostgreSQL, it has a built-in IP address data type which almost for sure does this. :-) Maybe what you want to d

Re: [PHP] function to compare ip addr to a ip range

2005-10-13 Thread tg-php
You could try converting to long IP addresses and comparing that way: http://us3.php.net/manual/en/function.ip2long.php $startip = "192.168.0.5"; $endip = "192.168.0.16"; $targetip = "192.168.0.7"; $startlong = ip2long($startip); $endlong = ip2long($endip); $targetlong = ip2long($targetip);

Re: [PHP] function to compare ip addr to a ip range>

2005-10-13 Thread Greg Donald
On 10/13/05, Bosky, Dave <[EMAIL PROTECTED]> wrote: > Does anyone have a function that will check if an ip address falls with > a starting/ending ip address range>> #!/usr/bin/php $ip && $ip2 < $ip3 || $ip2 < $ip && $ip2 > $ip3 ) { echo "In range\n"; } else { echo "Not in range\n"; }

[PHP] function to compare ip addr to a ip range>

2005-10-13 Thread Bosky, Dave
Does anyone have a function that will check if an ip address falls with a starting/ending ip address range>> Thanks, Dave ** HTC Disclaimer: The information contained in this message may be privileged and confidentia