// result, close connection $ds = new IPplanDbf() or myError($w, $p, my_("Could not connect to database")); // 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 send a registrar update for this customer as you are not a member of the customers admin group")); } $formerror = ""; $cnt = 0; foreach ($baseindex as $key => $value) { $value = floor($value); // dont trust values posted $result = $ds->GetBaseFromIndex($value); $row = $result->FetchRow(); $baseip = inet_ntoa($row["baseaddr"]); $size = $row["subnetsize"]; $swipmod = $row["swipmod"]; $swip = genSWIP($ds, $value, $baseip, inet_ntoa($row["baseaddr"] + $size - 1), $cust, $row["descrip"], $swipmod, $filename); insert($w, block("<pre>")); insert($w, text($swip)); insert($w, block("</pre><hr>")); $err = emailSWIP($swip); // on email error, fail if ($err) { $formerror .= my_("E-mail message was not sent") . "\n"; $formerror .= my_("Mailer Error: ") . $err; break; }
$ip = 0; } if (is_array($ip)) { foreach ($ip as $key => $value) { $ip[$key] = floor($value); } } else { $ip = floor($ip); } if (!$_GET and !$_POST) { myError($w, $p, my_("You cannot reload or bookmark this page!")); } $ds = new IPplanDbf() or myError($w, $p, "Could not connect to database"); // get info from base table - do this first as safety check and because // we need this info later $result = $ds->GetBaseFromIndex($baseindex); if (!($row = $result->FetchRow())) { 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