Wiki ⇒ v10 Developer's manual ⇒ Network ⇒ CPG Dragonfly™ CMS
14. 1: Network
This class mainly provides static methods to work, validate and modify the Internet Protocol, fully supports version four (IPv4) and version six (IPv6).
Have to be considered, that IPv6 doesn't work as IPv4 does and things get a little harder when each Internet Service Providers applies different packages to their customers.
With IPv4, if you want to filter a visitor and his entire LAN you will simply use something like 203.0.113.3.
With IPv6, instead, you would have to use at least a /64 mask; so for example if we have 2001:0db8:df:df:df:df:df:3 you will need to use 2001:0db8:df:df/64, if not a /56 or a /48.
This is because most ISP will assign a /64 to each mobile device, a /56 or a /48 to each other customer .
Dragonfly CMS will catch the entire 128bits of a IPv6, /128. This is done for general networking reasons allowing you to be very specific with your firewall rules.
Generally you will need to use a /64, but if you are sure that this is not a mobile network go for a /56.
Dragonfly_Net::ip( void )
Validate and returns the visitor IP, either v4 or v6
Dragonfly_Net::ipn( void )
Validate and returns the binary string of the visiting IP, either v4 or v6.
Dragonfly_Net::filterIP( string $ip, bool $local=false )
Validate the IP and return an array containing information about it, otherwise returns FALSE.
Dragonfly_Net::range( string $ip, int $cidr)
Validate and returns an array containing information about an IP range, NULL on failure.
Created: Thursday, May 03, 2012 (09:22:04) by NanoCaiordo
Updated: Thursday, May 03, 2012 (09:58:43) by NanoCaiordo