case "RESERVED": $color = "blue"; break; case "ASSIGNED": $color = "red"; break; } if (isset($_GET['action'])) { if ($_GET['action'] == 'calc') { print "<span id='head' style='color:" . $color . ";'>" . $netblock->get_IP() . "</span><br / > "; print "<div class = 'box'>Subnet mask = <span id='sub'>" . $netblock->get_netmask() . "</span></div>"; print "<div class = 'box'>Wildcard = <span id='sub'>" . $netblock->get_wildcard() . "</span></div>"; print "<div class = 'box'>Network = <span id='sub'>" . $netblock->get_network() . "</span></div>"; print "<div class = 'box'>Broadcast = <span id='sub'>" . $netblock->get_broadcast() . "</span></div>"; print "<div class = 'box'>Hostmin = <span id='sub'>" . $netblock->get_hostmin() . "</span></div>"; print "<div class = 'box'>Hostmax = <span id='sub'>" . $netblock->get_hostmax() . "</span></div>"; print "<div class = 'box'>Host Per Net = <span id='sub'>" . $netblock->get_hostPerNet(); } else { if ($_GET['action'] == 'desc') { $name = "NO OWNER"; if ($ip_db->get_owner_name() != "") { $name = $ip_db->get_owner_name(); } $assigned = "NO ASSIGNED TO"; if ($ip_db->get_assigned_to_name() != "") { $assigned = $ip_db->get_assigned_to_name(); } $location = "NO LOCATION"; if ($ip_db->get_location_name() != "") { $location = $ip_db->get_location_name(); }
if (isset($_POST['ip_merge_submit'])) { //print_r($_POST); if (isset($_POST['merge'])) { $merge = $_POST['merge']; $match = explode("/", $ip_info->get_address_ip()); $address = $match[0]; $ip_manager->set_IP($address . "/" . $merge, $ip_info->get_family()); if ($ip_info->get_family() == 4) { $max_length = 32; } else { if ($ip_info->get_family() == 6) { $max_length = 128; } } $host_min = $ip_manager->get_hostmin(); $host_max = $ip_manager->get_hostmax(); $min_ip_manager = new Netblock($host_min . "/" . $max_length); $max_ip_manager = new Netblock($host_max . "/" . $max_length); $parent_id = $ip_info->get_parent_id(); if (is_numeric($parent_id)) { $all_child_ip = IP_Database::get_all_ip($parent_id, $ip_info->get_family()); } $to_remove = array(); foreach ($all_child_ip as $ip => $addr) { $t_ip_info = new IP_Database($ip); if ($ip_info->get_family() == 4) { if ($t_ip_info->get_address_int() >= $ip_manager->get_long() && $t_ip_info->get_address_int() <= $max_ip_manager->get_long_ip()) { array_push($to_remove, $ip); } } else { if ($ip_info->get_family() == 6) {