Пример #1
0
     // remove all from list if global searching is not available
     if (!$displayall and strtolower($custrow["custdescrip"]) == "all") {
         continue;
     }
     // strip out customers user may not see due to not being member
     // of customers admin group.
     if (!$adminuser) {
         if (!empty($grps)) {
             if (!in_array($custrow["admingrp"], $grps)) {
                 continue;
             }
         }
     }
     $menustring = $menustring . ".|" . htmlspecialchars($custrow["custdescrip"]) . "|displaybase.php?cust=" . $custrow["customer"] . "||||{$expanded}\n";
     $menustring = $menustring . "..|" . my_("All subnets not part of range") . "|displaybase.php?cust=" . $custrow["customer"] . "&areaindex=-1||||\n";
     $arearesult = $ds->GetArea($custrow["customer"], 0);
     //area
     while ($arearow = $arearesult->Fetchrow()) {
         $menustring = $menustring . "..|" . htmlspecialchars(inet_ntoa($arearow["areaaddr"]) . " (" . $arearow["descrip"] . ")") . "|displaybase.php?cust=" . $custrow["customer"] . "&areaindex=" . $arearow["areaindex"] . "||||\n";
         $rangeresult = $ds->GetRangeInArea($custrow["customer"], $arearow["areaindex"]);
         //range
         while ($rangerow = $rangeresult->Fetchrow()) {
             $menustring = $menustring . "...|" . htmlspecialchars(inet_ntoa($rangerow["rangeaddr"]) . " (" . $rangerow["descrip"] . ")") . "|displaybase.php?cust=" . $custrow["customer"] . "&areaindex=" . $arearow["areaindex"] . "&rangeindex=" . $rangerow["rangeindex"] . "&descrip=&sortby=Base+Address" . "||||\n";
             $baseresult = $ds->GetBase($rangerow["rangeaddr"], $rangerow["rangeaddr"] + $rangerow["rangesize"] - 1, "", $custrow["customer"]);
             //subnet (base)
             while ($baserow = $baseresult->Fetchrow()) {
                 $menustring = $menustring . "....|" . htmlspecialchars(inet_ntoa($baserow["baseaddr"]) . " /" . inet_bits($baserow["subnetsize"]) . " (" . $baserow["descrip"] . ")") . "|displaysubnet.php?baseindex=" . $baserow["baseindex"] . "||||\n";
             }
         }
     }
 }
Пример #2
0
list($cust, $areaindex) = myRegister("I:cust I:areaindex");
$ds = new IPplanDbf() or myError($w, $p, my_("Could not connect to database"));
if ($_GET) {
    // save the last customer used
    // must set path else Netscape gets confused!
    setcookie("ipplanCustomer", "{$cust}", time() + 10000000, "/");
    // check if user belongs to customer admin group
    $result = $ds->GetCustomerGrp($cust);
    // can only be one row - does not matter if nothing is
    // found as array search will return false
    $row = $result->FetchRow();
    if (!in_array($row["admingrp"], $grps)) {
        myError($w, $p, my_("You may not delete an area for this customer as you are not a member of the customers admin group"));
    }
    if ($areaindex > 0) {
        $result = $ds->GetArea($cust, $areaindex);
        $row = $result->FetchRow();
        $areaip = inet_ntoa($row["areaaddr"]);
        $ds->DbfTransactionStart();
        $result =& $ds->ds->Execute("DELETE FROM area\n                              WHERE areaindex={$areaindex}") and $ds->AuditLog(array("event" => 152, "action" => "delete area", "area" => $areaip, "user" => getAuthUsername(), "cust" => $cust));
        if ($result) {
            $ds->DbfTransactionEnd();
            Header("Location: " . location_uri("modifyarearange.php?cust={$cust}"));
            exit;
            //insert($w,text(my_("Area deleted")));
        } else {
            insert($w, text(my_("Area could not be deleted")));
        }
    } else {
        insert($w, text("Area index is invalid"));
    }