// 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"))); insert($con, $legend = container("legend", array("class" => "legend"))); insert($legend, text(my_("User information"))); insert($con, textbr(my_("User"))); insert($con, input_text(array("name" => "user", "size" => "80", "maxlength" => "80"))); insert($con, block(" <a href='#' onclick='MODIFY.user.value=\"" . DHCPRESERVED . "\";'>" . my_("DHCP address") . "</a>")); insert($con, textbrbr(my_("Location"))); insert($con, input_text(array("name" => "location", "size" => "80", "maxlength" => "80"))); insert($con, textbrbr(my_("Device description"))); insert($con, input_text(array("name" => "descrip", "size" => "80", "maxlength" => "80"))); insert($con, textbrbr(my_("Telephone number"))); insert($con, input_text(array("name" => "telno", "size" => "15", "maxlength" => "15"))); insert($con, hidden(array("name" => "baseindex", "value" => $baseindex))); insert($con, hidden(array("name" => "block", "value" => $block))); insert($con, hidden(array("name" => "search", "value" => $search)));
// display opening text insert($w, heading(3, "{$title}.")); $ds = new IPplanDbf() or myError($w, $p, my_("Could not connect to database")); // start form insert($w, $f1 = form(array("name" => "THISFORM", "method" => "post", "action" => $_SERVER["PHP_SELF"]))); $cust = myCustomerDropDown($ds, $f1, $cust, $grps) or myError($w, $p, my_("No customers")); $areaindex = myAreaDropDown($ds, $f1, $cust, $areaindex); insert($w, $f2 = form(array("name" => "ENTRY", "method" => "get", "action" => "modifybase.php"))); // save customer name for actual post of data insert($f2, hidden(array("name" => "cust", "value" => "{$cust}"))); insert($f2, hidden(array("name" => "areaindex", "value" => "{$areaindex}"))); myRangeDropDown($ds, $f2, $cust, $areaindex); insert($f2, block("<p>")); insert($f2, $con = container("fieldset", array("class" => "fieldset"))); insert($con, $legend = container("legend", array("class" => "legend"))); insert($legend, text(my_("Search criteria"))); myFocus($p, "ENTRY", "ipaddr"); insert($con, textbr(my_("Subnet address (leave blank if range selected)"))); insert($con, span(my_("Partial subnet addresses can be used eg. 172.20"), array("class" => "textSmall"))); insert($con, input_text(array("name" => "ipaddr", "size" => "15", "maxlength" => "15"))); if (DBF_TYPE == "mysql" or DBF_TYPE == "maxsql" or DBF_TYPE == "postgres7") { insert($con, textbrbr(my_("Description (only display networks matching the regular expression)"))); } else { insert($con, textbrbr(my_("Description (only display networks containing)"))); } insert($con, input_text(array("name" => "descrip", "size" => "80", "maxlength" => "80"))); insert($con, generic("br")); insert($f2, submit(array("value" => my_("Submit")))); insert($f2, freset(array("value" => my_("Clear")))); myCopyPaste($f2, "ipplanCPmodbaseform", "ENTRY"); printhtml($p);
} // strip @ from email address if it exists $responsiblemail = str_replace("@", ".", $responsiblemail); insert($f, hidden(array("name" => "cust", "value" => "{$cust}"))); insert($f, hidden(array("name" => "serialdate", "value" => "{$serialdate}"))); insert($f, hidden(array("name" => "serialnum", "value" => "{$serialnum}"))); insert($f, heading(3, my_("{$myTitle} a Zone"))); insert($f, textbr(my_("Maintain forward zone SOA information."))); insert($f, $con = container("fieldset", array("class" => "fieldset"))); insert($con, $legend = container("legend", array("class" => "legend"))); insert($legend, text(my_("Forward zone information"))); insert($con, textbr(my_("Zone (Domain Name)"))); if ($action == "add") { insert($con, span(my_("Separate multiple domain names with ;"), array("class" => "textSmall"))); } myFocus($p, "ENTRY", "domain"); insert($con, input_text(array("name" => "domain", "value" => "{$domain}", "size" => "30", "maxlength" => "253"))); insert($con, checkbox(array("name" => "slaveonly"), "Slave Zone?", $slaveonly == "Y" ? "on" : "")); // if creating new zone, get dns servers from revdns table if ($action == "add") { // give option of reading zone from existing DNS server via zone transfer insert($con, textbrbr(my_("Zone transfer from DNS server"))); insert($con, span(my_("Blank for no zone transfer"), array("class" => "textSmall"))); insert($con, span(my_("Slave zones only import SOA information, not zone records"), array("class" => "textSmall"))); insert($con, input_text(array("name" => "server", "size" => "30", "maxlength" => "30"))); $result2 =& $ds->ds->Execute("SELECT hname,horder\n FROM revdns\n WHERE customer={$cust}"); if (DBF_TYPE == "mysql" or DBF_TYPE == "maxsql") { $version = $ds->ds->GetOne("SELECT version() AS version"); if ($version >= "4.0.14") { insert($con, textbrbr(my_("--- OR ---"))); insert($con, checkbox(array("name" => "clone"), "Clone zone records from template.com zone?"));
$cust = $col; $custset = 1; // remember that customer was blank } // only make customer same as cookie if customer actually // still exists in database, else will cause loop! if ($custset) { if ($col == $ipplanCustomer) { // dont trust cookie $cust = floor($ipplanCustomer); } } $lst["{$col}"] = $row["custdescrip"]; } insert($w, $f = form(array("name" => "ENTRY", "method" => "post", "action" => $_SERVER["PHP_SELF"]))); myFocus($p, "MODIFY", "request"); insert($f, textbrbr(my_("Customer"))); insert($f, selectbox($lst, array("name" => "cust"), $cust)); insert($f, textbrbr(my_("Request details"))); insert($f, span(my_("Enter full details describing the request to enable the administrators to allocate the correct IP address on the network"), array("class" => "textSmall"))); insert($f, input_text(array("name" => "request", "value" => $request, "size" => "80", "maxlength" => "80"))); insert($f, $con = container("fieldset", array("class" => "fieldset"))); insert($con, $legend = container("legend", array("class" => "legend"))); insert($legend, text(my_("User information"))); insert($con, textbr(my_("User"))); insert($con, input_text(array("name" => "user", "value" => $user, "size" => "80", "maxlength" => "80"))); insert($con, textbrbr(my_("Location"))); insert($con, input_text(array("name" => "location", "value" => $location, "size" => "80", "maxlength" => "80"))); insert($con, textbrbr(my_("Device description"))); insert($con, input_text(array("name" => "descrip", "value" => $descrip, "size" => "80", "maxlength" => "80"))); insert($con, textbrbr(my_("Device hostname")));
if ($action == 'add') { $host = ""; $RecordType = "A"; $iphostname = ""; insert($con, hidden(array("name" => "action", "value" => "add"))); insert($con, hidden(array("name" => "zoneid", "value" => "{$zoneid}"))); $myTitle = "Add"; } else { insert($con, hidden(array("name" => "action", "value" => "edit"))); insert($con, hidden(array("name" => "zoneid", "value" => "{$zoneid}"))); insert($con, hidden(array("name" => "dataid", "value" => "{$dataid}"))); $myTitle = "Edit"; } insert($con, hidden(array("name" => "domain", "value" => "{$domain}"))); insert($con, hidden(array("name" => "cust", "value" => "{$cust}"))); myFocus($p, "ENTRY", "host"); insert($con, textbr(my_("Host Name"))); insert($con, block("<small><i>")); insert($con, textbr(my_("Terminate Fully Qualified Domand Name's (FQDN) with a . eg. mywwwserver.com. to signify 'This domain'"))); insert($con, block("</small></i>")); insert($con, input_text(array("name" => "host", "value" => "{$host}", "size" => "40", "maxlength" => "253"))); insert($con, anchor("JavaScript:thisdomain()", my_("This domain"))); // add some javascript magic to follow a link if field is completed insert($p, script(' function thisdomain() { document.ENTRY.host.value="' . $domain . '."; } ', array("language" => "JavaScript", "type" => "text/javascript"))); insert($con, textbrbr(my_("Record Type"))); insert($con, selectbox(array("A" => "A", "CNAME" => "CNAME", "MX" => "MX", "TXT" => "TXT", "KEY" => "KEY", "SRV" => "SRV", "NS" => "NS", "AFSDB" => "AFSDB"), array("name" => "recordtype"), $recordtype)); insert($con, textbrbr(my_("IP / Hostname")));
$lst = array(); while ($row = $result->FetchRow()) { $col = $row["grp"]; $lst["{$col}"] = $row["grpdescrip"]; } if (empty($lst)) { myError($w, $p, my_("You first need to create some groups!")); } // start form insert($w, $f = form(array("name" => "ENTRY", "method" => "post", "action" => $_SERVER["PHP_SELF"]))); insert($f, $con = container("fieldset", array("class" => "fieldset"))); insert($con, $legend = container("legend", array("class" => "legend"))); insert($legend, text(my_("Required information"))); insert($con, textbr(my_("Customer/autonomous system description:"))); insert($con, hidden(array("name" => "cust", "value" => "{$cust}"))); myFocus($p, "ENTRY", "custdescrip"); insert($con, input_text(array("name" => "custdescrip", "value" => "{$custdescrip}", "size" => "80", "maxlength" => "80"))); insert($con, textbrbr(my_("Customer/autonomous system admin group:"))); insert($con, textbr(my_("WARNING: If you choose a group that you do not have access to, you will not be able to see or access the data"))); insert($con, selectbox($lst, array("name" => "grp"), $grp)); insert($f, submit(array("value" => my_("Submit")))); insert($f, freset(array("value" => my_("Clear")))); if ($_GET) { $result2 = $ds->GetCustomerDNSInfo($cust); $org = $row1["org"]; $street = $row1["street"]; $city = $row1["city"]; $state = $row1["state"]; $zipcode = $row1["zipcode"]; $cntry = $row1["cntry"]; $nichandl = $row1["nichandl"];
} else { insert($f, hidden(array("name" => "action", "value" => "edit"))); insert($f, hidden(array("name" => "zoneid", "value" => "{$zoneid}"))); $myTitle = "Edit"; } // strip @ from email address if it exists $responsiblemail = str_replace("@", ".", $responsiblemail); insert($f, hidden(array("name" => "serialdate", "value" => "{$serialdate}"))); insert($f, hidden(array("name" => "serialnum", "value" => "{$serialnum}"))); insert($f, hidden(array("name" => "cust", "value" => "{$cust}"))); insert($f, heading(3, my_("{$myTitle} a Zone"))); insert($f, textbr(my_("Maintain reverse zone SOA information"))); insert($f, $con = container("fieldset", array("class" => "fieldset"))); insert($con, $legend = container("legend", array("class" => "legend"))); insert($legend, text(my_("Reverse zone information"))); myFocus($p, "ENTRY", "zone"); insert($con, textbr(my_("Zone (Domain Name)"))); if ($action == "add") { insert($con, span(my_("Separate multiple domain names with ;"), array("class" => "textSmall"))); insert($con, span(my_("Sample domain would be 20.172.in-addr.arpa"), array("class" => "textSmall"))); } insert($con, input_text(array("name" => "zone", "value" => "{$zone}", "size" => "30", "maxlength" => "253"))); insert($con, checkbox(array("name" => "slaveonly"), "Slave Zone?", $slaveonly == "Y" ? "on" : "")); insert($con, textbrbr(my_("Zone (Base IP of Zone)"))); insert($con, input_text(array("name" => "zoneip", "value" => empty($zoneip) ? "" : inet_ntoa($zoneip), "size" => "15", "maxlength" => "15"))); //insert($f,generic("br")); insert($con, textbrbr(my_("Reverse zone size/mask"))); insert($con, selectbox(array("4" => "255.255.255.252/30 - 4 hosts", "8" => "255.255.255.248/29 - 8 hosts", "16" => "255.255.255.240/28 - 16 hosts", "32" => "255.255.255.224/27 - 32 hosts", "64" => "255.255.255.192/26 - 64 hosts", "128" => "255.255.255.128/25 - 128 hosts", "256" => "255.255.255.0/24 - 256 hosts (class C)", "512" => "255.255.254.0/23 - 512 hosts", "1024" => "255.255.252.0/22 - 1k hosts", "2048" => "255.255.248.0/21 - 2k hosts", "4096" => "255.255.240.0/20 - 4k hosts", "8192" => "255.255.224.0/19 - 8k hosts", "16384" => "255.255.192.0/18 - 16k hosts", "32768" => "255.255.128.0/17 - 32k hosts", "65536" => "255.255.0.0/16 - 64k hosts (class B)", "131072" => "255.254.0.0/15 - 128k hosts", "262144" => "255.252.0.0/14 - 256k hosts"), array("name" => "size"), $size)); // if creating new zone, get dns servers from revdns table if ($action == "add") { // give option of reading zone from existing DNS server via zone transfer