Re: allowing access to php page by IP
| From: | Chris Boget | Date: | Tue, 07 Oct 2003 14:38:12 +0000 |
| Subject: | Re: allowing access to php page by IP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165307@lists.php.net to get a copy of this message | ||
> certain webpage and keep everyone else out. I have written code to figure
> out what someone's IP is, but am not sure about how I should verify
> whether the IP is in the range of 10.8.4.* or 10.8.5.*. Any suggestions?
$ipArray = explode( '.', $ipAddress );
if(( $ipArray[0] == 10 ) &&
( $ipArray[1] == 8 ) &&
(( $ipArray[2] >=4 ) && ( $ipArray[2] <=5 ))) {
echo 'Access granted';
} else {
echo 'Get lost, ya bum!';
}
Chris