Login   Register  
PHP Classes
elePHPant
Icontem

IP Address Subnet Sniffer: Determine if an IP address belongs to a subnetwork

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2005-11-08 (8 years ago) RSS 2.0 feedStarStarStar 51%Total: 1,482 This week: 1All time: 2,431 This week: 1,435Up
Version License Categories  
ipaddresssubnetsniff 1.0GNU General Public Lice...Networking
Description Author  

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.

Picture of Jeffrey Silverman
Name: Jeffrey Silverman <contact>
Classes: 2 packages by
Country: United States United States
Age: ???
All time rank: 945123 in United States United States
Week rank: 1071 Down129 in United States United States Down

  Files folder image Files  
File Role Description
Plain text file 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.
Accessible without login Plain text file README Data Shorty documentation

 Version Control Unique User Downloads Download Rankings  
 0%Total:1,482All time:2,431
 This week:1This week:1,435Up
User Ratings User Comments (1)  
 All time
Utility:87%StarStarStarStarStar
Consistency:81%StarStarStarStarStar
Documentation:-
Examples:-
Tests:-
Videos:-
Overall:51%StarStarStar
Rank:1486
 
Excellent
4 years ago (kishore kumar)
60%StarStarStarStar