This class can be used to determine wether a given IP address belongs to a given list of subnetworks.
The class takes an array of subnetwork masks to be checked in the form of strings with decimal numbers seperated dots .
Then the class can check whether a given IP address belongs to any of the specified subnetworks by applying the respective masks.
This class was created to emulate the "Deny from x.x.x.x" directive for Apache (nd other servers -- for example, Samba uses a similar format for allowing/denying access to a range of IP addresses). I needed a way to deny/allow access to a range of IP addresses but, for technical reasons, I could not use a .htaccess file, and had to do the IP address processing within the PHP script itself.
For example, you can emulate the line "Deny from 192.168.0.0/24" by supplying the string "192.168.0.0/24" to the class. To see exactly how to do this, see the documentation within the class file itself.
| There are not enough user ratings to display for this class. |
No application links were specified for this class.

If you know an application of this package, send a message to the
author to add a link here.
| File |
Role |
Description |
IPAddressSubnetSniffer.php |
Class |
This class determines whether a given IP address is in a given list of subnets. The idea is to use this determination to allow/deny access to a PHP script based on IP address. Because of the way a particular web environment that I was using was set up, I was unable to use a .htaccess file for this task. I could not find a built-in PHP function or functions to do this task, so this class was built. |
README |
Data |
Shorty documentation |