case "FREE": $color = "green"; break; 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 it's adding a new network if (isset($_POST['add'])) { //check if the ip is valid if ($ip_manager->get_IP() != "INVALID") { //set all the values if it's valid $n_ip = new IP_Database(); $n_ip->set_address_int($ip_manager->get_long()); $n_ip->set_subnet_size($ip_manager->get_length()); $n_ip->set_description(""); $n_ip->set_family($ip_manager->get_family()); $n_ip->set_title($_POST['title']); //IAM HERE TRYING TO INSTALL SEARCH AND ADD IP $i_match = explode("/", $ip_manager->get_IP()); //check if the ip and subnet are valid combinations if ($ip_manager->get_long_ip() != $ip_manager->get_long()) { echo Form::warning("Your IP is invalid, the IP is changed from " . $i_match[0] . " to " . $ip_manager->get_network()); } //inserting the IP, if it fails show the error if (!$n_ip->insert()) { echo Form::error($n_ip->get_error()); } } else { //If IP info is invalid this message shows echo Form::warning("INVALID INFO TRY AGAIN"); exit; } } //If a network id is posted, it means a modification (update, split, host, or delete) is called if (isset($_POST['id'])) { //Get this network information from the database $ip_info = new IP_Database($_POST['id']);