コード例 #1
0
ファイル: class.dbflib.php プロジェクト: hetznerZA/ipplan
 function FetchBase($cust, $areaindex, $rangeindex)
 {
     // use local function variables as they may change
     $this->cust = $cust;
     $this->rangeindex = $rangeindex;
     $this->areaindex = $areaindex;
     // set start and end address according to netrange
     if ($this->rangeindex) {
         // should only return one row here!
         $result = $this->GetRange($this->cust, $this->rangeindex);
         $row = $result->FetchRow();
         $this->start = inet_ntoa($row["rangeaddr"]);
         $this->end = inet_ntoa($row["rangeaddr"] + $row["rangesize"] - 1);
         $this->site = " (" . $row["descrip"] . ")";
     } else {
         if ($this->ipaddr) {
             if ($this->subnetsize) {
                 $this->start = $this->ipaddr;
                 $this->end = inet_ntoa(inet_aton($this->ipaddr) + $this->subnetsize - 1);
             } else {
                 $this->start = completeIP($this->ipaddr, 1);
                 $this->end = completeIP($this->ipaddr, 2);
             }
             if (testIP($this->start) or testIP($this->end)) {
                 $this->err = 50;
                 // Invalid IP address!
                 $this->errstr = my_("Invalid IP address!");
                 return FALSE;
             }
         } else {
             $this->start = DEFAULTROUTE;
             $this->end = ALLNETS;
         }
     }
     $startnum = inet_aton($this->start);
     $endnum = inet_aton($this->end);
     // pager could have made cust = 0
     if ($this->cust == 0) {
         $this->custdescrip = "All";
     } else {
         $this->custdescrip = $this->GetCustomerDescrip($this->cust);
     }
     if (strtolower($this->custdescrip) == "all") {
         $this->cust = 0;
     }
     if ($this->areaindex == -1) {
         // all subnets not part of an area
         $result = $this->GetBaseNoArea($this->descrip, $this->cust, $this->grps);
     } else {
         if ($this->areaindex and !$this->rangeindex) {
             $result = $this->GetBaseFromArea($this->areaindex, $this->descrip, $this->cust, $this->grps);
         } else {
             // search in subnet - finds subnets with exact ip address match
             // useful for finding from where an attack comes if you have IP
             if ($this->searchin == 0) {
                 $result = $this->GetBase($startnum, $endnum, $this->descrip, $this->cust, $this->grps);
             } else {
                 if ($this->cust == 0) {
                     $result = $this->GetDuplicateSubnetAll($startnum, 1, $this->grps);
                 } else {
                     $result = $this->GetDuplicateSubnet($startnum, 1, $this->cust);
                 }
             }
         }
     }
     return $result;
 }
コード例 #2
0
ファイル: displayswip.php プロジェクト: hetznerZA/ipplan
if (!in_array($row["admingrp"], $grps)) {
    myError($w, $p, my_("You may not send a registrar update for this customer as you are not a member of the customers admin group"));
}
// set start and end address according to range
$site = "";
if ($rangeindex) {
    // should only return one row here!
    $result = $ds->GetRange($cust, $rangeindex);
    $row = $result->FetchRow();
    $start = inet_ntoa($row["rangeaddr"]);
    $end = inet_ntoa($row["rangeaddr"] + $row["rangesize"] - 1);
    $site = " (" . $row["descrip"] . ")";
} else {
    if ($ipaddr) {
        $start = completeIP($ipaddr, 1);
        $end = completeIP($ipaddr, 2);
        if (testIP($start) or testIP($end)) {
            myError($w, $p, my_("Invalid IP address!"));
        }
    } else {
        $start = DEFAULTROUTE;
        $end = ALLNETS;
    }
}
$startnum = inet_aton($start);
$endnum = inet_aton($end);
$custdescrip = $ds->GetCustomerDescrip($cust);
if ($areaindex and !$rangeindex) {
    insert($w, heading(3, sprintf(my_("Search for IP subnets between multiple ranges for customer '%s'"), $custdescrip)));
    $result = $ds->GetBaseFromArea($areaindex, $descrip, $cust);
} else {