insert($w, textbr()); $cnt = 0; // search only for subnets marked dhcp $ds->dhcp = 1; $result = $ds->GetBase($startnum, $endnum, '', $cust); // loop through each subnet looking for a template while ($row = $result->FetchRow()) { $baseaddr = inet_ntoa($row["baseaddr"]); $baseindex = $row["baseindex"]; $descrip = $row["descrip"]; $size = inet_ntoa(inet_aton(ALLNETS) + 1 - $row["subnetsize"]); $broadcast = inet_ntoa($row["baseaddr"] + $row["subnetsize"] - 1); $result_template =& $ds->ds->Execute("SELECT info, infobin\n FROM baseadd\n WHERE baseindex={$baseindex}"); // no template defined on subnet, skip subnet if ($rowadd = $result_template->FetchRow()) { $template->Clear(); $template->Merge($template->decode($rowadd["info"])); insert($w, textbr(sprintf(my_("Exporting DHCP for %s"), $baseaddr))); //NOTE: need to check that correct template vars are available here!!! // else throw message and skip subnet!!! } else { // skip rest as no template on subnet continue; } // end template // first one found, open file for writing if ($cnt == 0) { $tmpfname = tempnam(DHCPEXPORTPATH, "dhcp_"); if (!$tmpfname) { myError($w, $p, my_("Could not create temporary file!")); }