array( // separate IPs '78.111.219.54', // UA office vega '24.118.167.19', // US office ), 14 => array( // xx.xx.xx.xx/14 networks '37.52.0.0', // Ukrtelecom '46.200.0.0', // Ukrtelecom '95.132.0.0', // Ukrtelecom '178.92.0.0', // Ukrtelecom ), 15 => array( '92.112.0.0', // Ukrtelecom '94.178.0.0', // Ukrtelecom ), 16 => array( '5.248.0.0', // Kyivstar GSM '37.115.0.0', // Kyivstar GSM '37.229.0.0', // Kyivstar GSM '46.118.0.0', // Kyivstar GSM '46.211.0.0', // Kyivstar GSM '91.124.0.0', // Ukrtelecom '94.153.0.0', // Kyivstar GSM '134.249.0.0', // Kyivstar GSM '176.8.0.0', // Kyivstar GSM '178.137.0.0', // Kyivstar GSM ), 17 => array( '46.119.128.0', // Kyivstar GSM '46.185.0.0', // Kyivstar GSM '82.207.0.0', // Ukrtelecom '109.162.0.0', // Kyivstar GSM ), 18 => array( '46.119.64.0', // Kyivstar GSM '92.52.128.0', // Bitternet ), 19 => array( '195.5.0.0', // Ukrtelecom '195.5.32.0', // Ukrtelecom '213.179.224.0', // Ukrtelecom ), 20 => array( '81.23.16.0', // Kyivstar GSM '80.243.144.0', // Bitternet '217.196.160.0', // Bitternet ), 21 => array( '5.255.160.0', // Bitternet ), 22 => array( '193.41.60.0', // Kyivstar GSM '194.187.228.0', // Dinines/Gustav ), 23 => array( '195.114.120.0', // Bitternet ), ); // notes: // - Ukrtelecom IPs were taken from here http://www.nirsoft.net/countryip/ua.html // - list of AS allocations http://bgp.potaroo.net/cidr/autnums.html // - search CIDR list by ASN http://www.cidr-report.org/as2.0/ // implementation function prepareMask($bits) { $bit_string = str_repeat('1', $bits) . str_repeat('0', 32 - $bits); $mask = bindec($bit_string); return $mask; } $masks = array(0, 0xffffffff); //$masks = array(0xffffffff); foreach($except_ip as $bits => $ips){ $mask = prepareMask($bits); foreach($ips as $ip){ $ip_long = ip2long($ip); $ip_masked = $ip_long & $mask; $output = array(); foreach($masks as $m){ $ip = $ip_masked | (~$mask & $m); $output[] = long2ip($ip); } echo implode(' - ', $output), "
\n"; } }