5 static function isValid($ip, $mask = 0)
7 $ipv4 = ereg('^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$', $ip);
8 $ipv6 = ereg("^[0-9a-fA-F:]+$", $ip);
10 if(!$ipv6&&!$ipv4) return false;
20 // now check that we have $sns number of subnets specified
21 $pss = explode(":", $ip);
24 // we need to specify an error we can throw back at the user
26 error_log("no 2, $ns, $sns, $ip");
30 for($i = 0; $i < $sns; $i++) {
31 if(strlen($pss[$i]) < 1) {
37 // we are still a valid ipv6 ip address/mask
51 static function truncateNetwork($ip, $mask)
53 $ipv4 = ereg('^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$', $ip);
54 $ipv6 = ereg("^[0-9a-fA-F:]+$", $ip);
56 if(!$ipv6&&!$ipv4) return false;
66 // now check that we have $sns number of subnets specified
67 $pss = explode(":", $ip);
70 // we need to specify an error we can throw back at the user
72 error_log("no 2, $ns, $sns, $ip");
78 for($i = 0; $i < $sns; $i++) {
79 if(strlen($pss[$i]) < 1) {
87 // we are still a valid ipv6 ip address/mask
101 function addSupernet($supernet)
106 function addSubnet($subnet)
111 function isConflicting($subnet)