Ejemplo n.º 1
0
function getIpRanges()
{
    global $glpisubnets;
    $ip_ranges = [];
    $subnets = explode(',', $glpisubnets);
    foreach ($subnets as $subnet) {
        $cidr = explode('/', $subnet);
        $cidr = parseIpAddress($cidr[0], $cidr[1]);
        $range = array(ip2long($cidr['network']), ip2long($cidr['broadcast']));
        array_push($ip_ranges, $range);
    }
    return $ip_ranges;
}
Ejemplo n.º 2
0
    require_once '../../functions/functions.php';
    /* format posted values! */
    $tmp = explode("|", $_POST['direction']);
    $sort['field'] = $tmp[0];
    $sort['direction'] = $tmp[1];
    if ($sort['direction'] == "asc") {
        $sort['directionNext'] = "desc";
    } else {
        $sort['directionNext'] = "asc";
    }
    /** 
     * Parse IP addresses
     *
     * We provide subnet and mask, all other is calculated based on it (subnet, broadcast,...)
     */
    $SubnetParsed = parseIpAddress(transform2long($SubnetDetails['subnet']), $SubnetDetails['mask']);
}
/* verify that user is authenticated! */
isUserAuthenticated();
/* get all selected fields for IP print */
$setFields = getSelectedIPaddrFields();
/* format them to array! */
$setFields = explode(";", $setFields);
/**
 * Get all ip addresses in subnet and subnet details!
 */
$title = _("IP addresses in subnet ");
# prefix for multiple subnets
if (sizeof($slaves) == 0) {
    $ipaddresses = getIpAddressesBySubnetIdSort($subnetId, $sort['field'], $sort['direction']);
    $slavePing = false;