Beispiel #1
0
 if (isset($_POST['ip_assign'])) {
     IP_Database::assign_ip_by_id($_POST['id'], $_POST['ip_status']);
 } else {
     if (isset($_POST['ip_host'])) {
         //get the ip and do some calculatins
         $ip = $_POST['ip_hostip'] . "/" . $_POST['ip_hostsubnet'];
         $ip_manager->set_IP($ip, $ip_info->get_family());
         //check if the host is a valid host
         if ($ip_manager->get_is_negative() == false) {
             //if not then create a new manager to calculate for more checks
             $test_manager = new Netblock($ip_info->get_address_ip());
             //if the address is part of the network, then create a new host
             if (substr($ip_manager->get_binary(), 0, $ip_info->get_subnet_size()) == substr($test_manager->get_binary(), 0, $ip_info->get_subnet_size())) {
                 //set the information
                 $host = new IP_Database();
                 $host->set_address_int($ip_manager->get_long());
                 $host->set_subnet_size($ip_manager->get_length());
                 $host->set_description($ip_info->get_description());
                 $host->set_family($ip_info->get_family());
                 //set the parent
                 $host->set_parent_id($ip_info->get_netblock_id());
                 //if there are any inheritance of information, inherit them
                 if ($_POST['inh_loc'] == "on") {
                     $host->set_location_id($ip_info->get_location_id());
                 }
                 if ($_POST['inh_owner'] == "on") {
                     $host->set_owner_id($ip_info->get_owner_id());
                 }
                 if ($_POST['inh_assigned'] == "on") {
                     $host->set_assigned_to_id($ip_info->get_assigned_to_id());
                 }