예제 #1
0
    myError($w, $p, my_("Subnet cannot be found!"));
}
$maxcnt = $row["subnetsize"];
$baseaddr = $row["baseaddr"];
$netdescrip = $row["descrip"];
$cust = $row["customer"];
// script gets called back from modifyipform script so that user does
// not need to press back button
if ($_POST) {
    if ($grp = $ds->GetBaseGrp($baseindex)) {
        if (in_array($grp, $grps) or $ds->TestCustomerGrp($baseindex, getAuthUsername())) {
            // ---------------- are first x IP addresses of subnet blocked? ---------------
            // ---------------- check that addresses are within subnet      ---------------
            // get lowest number of addresses in subnet that user is not allowed to
            // modify - normally zero. If user belongs to multiple groups, takes lowest value
            $limit = $ds->ds->GetOne("SELECT min(resaddr) AS cnt FROM grp WHERE grp " . $ds->grpSQL($grps));
            foreach ((array) $ip as $iptemp) {
                // cast ip to array
                if ($iptemp - $baseaddr < $limit) {
                    myError($w, $p, sprintf("You may not modify the first %s subnet addresses", $limit));
                }
                if ($iptemp - $baseaddr < 0 or $iptemp - $baseaddr >= $maxcnt) {
                    myError($w, $p, "An address you are attempting to modify is outside of the subnet");
                }
            }
            // ---------------- end check ---------------
            // --------- test if ip addresses to update are within bounds ----------
            foreach ($grps as $value) {
                foreach ((array) $ip as $ipvalue) {
                    if ($extst = $ds->TestBounds($ipvalue, 1, $value)) {
                        // got an overlap, allowed to create