<?php include_once '../../plugins/IP Manager/Netblock.php'; if (isset($_POST['net']) && isset($_POST['length']) && is_numeric($_POST['length']) && $_POST['net'] != '') { $net = $_POST['net']; $length = $_POST['length']; $netblock = new Netblock("{$net}/{$length}"); if ($netblock->get_family() != 4 && $netblock->get_family() != 6) { //print "Invalid address<br>"; return; } else { echo "<p><hr>"; echo $netblock->print_all(); } }
} else { $ip = ""; } } if (isset($_POST['desc'])) { $desc = $_POST['desc']; } else { $desc = ""; } if ($ip == "/") { echo "<h1>Enter an IP!</h1>"; exit; } $ip_manager = new Netblock($ip, $desc); if (isset($_POST['view'])) { $ip_manager->print_all(); } else { if (isset($_POST['add'])) { if ($ip_manager->get_IP() != "INVALID") { IP_Database::add_ip_to_db($ip_manager->get_long(), $ip_manager->get_length(), $ip_manager->get_desc(), $ip_manager->get_family()); } else { echo "INVALID INFO TRY AGAIN"; exit; } } } } echo "<hr/>"; if (isset($_POST['ip_split_submit'])) { $ip_info = IP_Database::get_ip_by_id($_POST['id']); $ip_manager->set_IP($ip_info->get_address_ip() . "/" . $ip_info['subnet_size'], $ip_info['family']);