Пример #1
0
function getEachIpInRange($cidr)
{
    $ips = array();
    $range = getIpRange($cidr);
    for ($ip = $range['firstIP']; $ip <= $range['lastIP']; $ip++) {
        $ips[] = long2ip($ip);
    }
    return $ips;
}
Пример #2
0
 function calcIpRange()
 {
     $ipAddress = $this->ip;
     $subnet_and_mask = explode('/', $ipAddress);
     if (count($subnet_and_mask) == 2) {
         $ipRange = getIpRange($ipAddress);
         $startIp = $ipRange[0];
         $endIp = $ipRange[1];
     } else {
         $startIp = ip2long($ipAddress);
         $endIp = $startIp;
     }
     //echo("\r\n<br/>$ipAddress: " . sprintf('%u', $startIp) . " - " .  sprintf('%u', $endIp));
     $this->startIpVal = $startIp;
     $this->endIpVal = $endIp;
 }
Пример #3
0
 function calcIpRange()
 {
     $ipAddress = $this->ip;
     $subnet_and_mask = explode('/', $ipAddress);
     if (count($subnet_and_mask) == 2) {
         require_once ROOT_DIR . '/Drivers/marmot_inc/ipcalc.php';
         $ipRange = getIpRange($ipAddress);
         $startIp = $ipRange[0];
         $endIp = $ipRange[1];
     } else {
         $startIp = ip2long($ipAddress);
         $endIp = $startIp;
     }
     //echo("\r\n<br/>$ipAddress: " . sprintf('%u', $startIp) . " - " .  sprintf('%u', $endIp));
     $this->startIpVal = $startIp;
     $this->endIpVal = $endIp;
 }