$Result = new Result(); $User = new User($Database); $Subnets = new Subnets($Database); $Sections = new Sections($Database); $Tools = new Tools($Database); # verify that user is logged in $User->check_user_session(); # get requested IP addresses in CIDR format $cidr = $_POST['cidr']; # verify input CIDR and die if errors $errors = $Subnets->verify_cidr_address($cidr, false); $errors === true ?: $Result->show("danger alert-absolute", _('Invalid input') . ': ' . $errors, true); # fetch all sections $all_sections = $Sections->fetch_all_sections(); # calculate results $calc_results = $Tools->calculate_ip_calc_results($cidr); ?> <hr> <h4><?php print _('Subnetting details for'); ?> <?php print $cidr; ?> :</h4> <!-- IPcalc result table --> <table class="ipCalcResult table table-striped table-condensed"> <!-- IP details -->
$Addresses = new Addresses($Database); # verify that user is logged in $User->check_user_session(); # id must be numeric is_numeric($_POST['id']) || strlen($_POST['id']) == 0 ?: $Result->show("danger", _("Invalid ID"), true); # get IP address id $id = $_POST['id']; # fetch address, subnet, vlan and nameservers $address = (array) $Addresses->fetch_address(null, $id); $subnet = (array) $Subnets->fetch_subnet(null, $address['subnetId']); $vlan = (array) $Tools->fetch_object("vlans", "vlanId", $subnet['vlanId']); $nameservers = (array) $Tools->fetch_object("nameservers", "id", $subnet['nameserverId']); # get all custom fields $custom_fields = $Tools->fetch_custom_fields('ipaddresses'); # get subnet calculation $subnet_calculation = $Tools->calculate_ip_calc_results($subnet['ip'] . "/" . $subnet['mask']); # checks sizeof($address) > 0 ?: $Result->show("danger", _("Invalid ID"), true); sizeof($subnet) > 0 ?: $Result->show("danger", _("Invalid subnet"), true); # set title $title = _('IP address details') . ' :: ' . $address['ip']; # address $content[] = "• " . _('IP address') . ": \t\t {$address['ip']}/{$subnet['mask']}"; # description empty($address['description']) ?: ($content[] = "• " . _('Description') . ":\t\t {$address['description']}"); # hostname empty($address['dns_name']) ?: ($content[] = "• " . _('Hostname') . ": \t\t {$address['dns_name']}"); # subnet desc $s_descrip = empty($subnet['description']) ? "" : " (" . $subnet['description'] . ")"; # subnet $content[] = "• " . _('Subnet') . ": \t\t {$subnet['ip']}/{$subnet['mask']} {$s_descrip}";