$subnet = $misc->GenDropMenuWSelectedSubnets($subs, $tmp[$x]['subnet'], 'subnet_tmp'); // quick check to ensure subnet from import matches existing subnet group if (!in_array($tmp[$x]['subnet'], $subs) && !empty($tmp[$x]['subnet'])) { $subnet_err[$x] = $err->GenerateErrorImg($defined['error'], "help/help.html#import_host", '800', '800'); $list .= "<li>Subnet field from import does match current list of existing subnet groups</li>"; } } // populate our pxe group list $px = "SELECT `pxe-group-name` FROM `conf_pxe_groups` ORDER BY `pxe-group-name` ASC"; if (($return = $db->dbQuery($val->ValidateSQL($px, $dbconn), $dbconn)) !== -1) { $pxeg = $db->dbArrayResultsAssoc($return); } if (count($pxeg) === 0) { $pxe_group = "No PXE Groups defined"; } else { $pxe_group = $misc->GenDropMenuWSelectedPXE($pxeg, $tmp[$x]['pxe_group'], 'pxe_group_tmp'); // quick check to ensure pxe group form import matches existin pxe group if (!in_array($tmp[$x]['pxe_group'], $pxeg) && !empty($tmp[$x]['pxe_group'])) { $pxe_group_err[$x] = $err->GenerateErrorImg($defined['error'], "help/help.html#import_host", '800', '800'); $list .= "<li>PXE Group field from import does match current list of existing PXE groups</li>"; } } // find matching fields and display as errors $e = $err->GenerateErrorImg($defined['error'], "help/help.html#import_host", '800', '800'); if ($tmp[$x]['hostname'] === $found[0]['hostname']) { $list .= "<li>Hostname field already exists in database</li>"; $hostname_err[] = $e; } if ($tmp[$x]['mac_address'] === $found[0]['mac-address']) { $list .= "<li>MAC Address field already exists in database</li>"; $mac_address_err[] = $e;
} else { $subnet_name = "No Subnets defined"; } // populate our pxe group list if ($group === "admin") { $px = "SELECT `pxe-group-name` FROM `conf_pxe_groups` ORDER BY `pxe-group-name` ASC"; } else { $px = "SELECT `pxe-group-name` FROM `conf_pxe_groups` WHERE `group` = \"" . $group . "\" OR `group` = '' ORDER BY `pxe-group-name` ASC"; } if (($return = $db->dbQuery($val->ValidateSQL($px, $dbconn), $dbconn)) !== -1) { $pxeg = $db->dbArrayResultsAssoc($return); } if (count($pxeg) === 0) { $pxe_group = "No PXE Groups defined"; } else { $pxe_group = $misc->GenDropMenuWSelectedPXE($pxeg, $pxe_group, 'pxe_group'); } // do some calculations on the list of available subnets $sql = "SELECT * FROM `conf_subnets`"; if (($return = $db->dbQuery($val->ValidateSQL($sql, $dbconn), $dbconn)) !== -1) { $data = $db->dbArrayResultsAssoc($return); } if (count($data) !== 0) { foreach ($data as $key => $value) { if ($value['enable-scope'] === "true" && !empty($value['scope-range-1']) && !empty($value['scope-range-2'])) { $ip_counts[] = $misc->GetAvailableIPAddresses($value, $value['subnet-name']); } else { if (!empty($value['pool'])) { // process assigned pool IP addresses minus IP's engaged in `conf_leases` table $sql = "SELECT * FROM `conf_pools` WHERE `pool-name` = \"" . $value['pool'] . "\""; if (($return = $db->dbQuery($val->ValidateSQL($sql, $dbconn), $dbconn)) !== -1) {