Пример #1
0
list($cust, $rangeindex) = myRegister("I:cust I:rangeindex");
$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 ($rangeindex > 0) {
        $result = $ds->GetRange($cust, $rangeindex);
        $row = $result->FetchRow();
        $rangeip = inet_ntoa($row["rangeaddr"]);
        $rangesize = $row["rangesize"];
        $ds->DbfTransactionStart();
        $result =& $ds->ds->Execute("DELETE FROM netrange\n                              WHERE rangeindex={$rangeindex}") and $ds->AuditLog(array("event" => 162, "action" => "delete range", "baseaddr" => $rangeip, "user" => getAuthUsername(), "size" => $rangesize, "cust" => $cust));
        if ($result) {
            $ds->DbfTransactionEnd();
            Header("Location: " . location_uri("modifyarearange.php?cust={$cust}"));
            exit;
            //insert($w,text(my_("Range deleted")));
        } else {
            insert($w, text(my_("Range could not be deleted")));
        }
    } else {
        insert($w, text(my_("Range index is invalid")));