//setdefault("text",array("size"=>"2")); $title = my_("Modify IP address details (range)"); newhtml($p); $w = myheading($p, $title, true); // explicitly cast variables as security measure against SQL injection list($baseindex, $block, $ip, $search, $expr, $ipplanParanoid) = myRegister("I:baseindex I:block A:ip S:search S:expr I:ipplanParanoid"); //$ip=array($ip); // type array if (!$_POST) { myError($w, $p, my_("You cannot reload or bookmark this page!")); } // basic sequence is connect, search, interpret search // result, close connection $ds = new IPplanDbf() or myError($w, $p, my_("Could not connect to database")); // save md5str for check in displaysubnet.php to see if info has // been modified since start of edit $md5str = $ds->GetMD5($ip, $baseindex); insert($w, block("<h3>")); insert($w, text(my_("IP Addresses to modify: "))); foreach ($ip as $value) { insert($w, text(inet_ntoa($value) . " ")); } insert($w, block("<small>")); if (isset($_SERVER['HTTP_REFERER']) and stristr($_SERVER['HTTP_REFERER'], "displaysubnet.php")) { insert($w, anchor($_SERVER['HTTP_REFERER'], my_("Back to subnet"))); } insert($w, block("</small>")); insert($w, block("</h3>")); // start form insert($w, $f = form(array("name" => "MODIFY", "method" => "post", "action" => "displaysubnet.php"))); myFocus($p, "MODIFY", "user"); insert($f, $con = container("fieldset", array("class" => "fieldset")));
// got an overlap, allowed to create break 2; } } } // could not find address within any of the defined bounds // so do not update if (!$extst) { if (is_array($ip)) { myError($w, $p, my_("IP addresses not updated - out of defined authority boundary") . "\n"); } else { myError($w, $p, sprintf(my_("IP address %s not updated - out of defined authority boundary"), inet_ntoa($ip)) . "\n"); } } // ---------------- end check --------------- if ($md5str != $ds->GetMD5($ip, $baseindex)) { myError($w, $p, my_("Another user modified the information before you saved - restart")); } $ds->DbfTransactionStart(); // additional information will arrive as assoc array called template // this is serialized into the info blob field of the database // need to start class and verify data before inserting if ($action == "delete") { // loop through array returned from modifyipmulform.php foreach ((array) $ip as $iptemp) { // cast to array if not array already // remove all attached files RemoveAllFiles($ds, $baseindex, $iptemp); // are there auto A records to delete? $formerror .= DeleteDNS($ds, $w, $cust, $iptemp); $ds->DeleteIP($iptemp, $baseindex);