function host_edit() { $_POST["edit-mac"] = str_replace("-", ":", $_POST["edit-mac"]); $mac = trim(strtolower($_POST["edit-mac"])); if (!IsPhysicalAddress($mac)) { echo "host_edit():: {$mac}!! pattern failed\n"; return; } $q = new mysql(); $tpl = new templates(); if (!$q->FIELD_EXISTS('dhcpd_fixed', "domain-name-servers-2", 'artica_backup')) { $sql = "ALTER TABLE `dhcpd_fixed` ADD `domain-name-servers-2` VARCHAR( 90 )"; $q->QUERY_SQL($sql, "artica_backup"); } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT mac FROM dhcpd_fixed WHERE `mac`='{$_POST["edit-mac"]}'", "artica_backup")); if (trim($ligne["mac"]) == null) { $_POST["new-mac"] = $mac; host_new(); } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM dhcpd_fixed WHERE `ipaddr`='{$_POST["ipaddr"]}'", "artica_backup")); if (trim($ligne["mac"]) != null) { if ($ligne["mac"] != $_POST["edit-mac"]) { echo $tpl->javascript_parse_text("host_edit({$_POST["edit-mac"]}):: {ipaddr}:{$_POST["ipaddr"]} {already_exists}: [{$ligne["mac"]}]"); return; } } $sql = "UPDATE dhcpd_fixed SET \n\t\thostname='{$_POST["hostname"]}',\n\t\tipaddr='{$_POST["ipaddr"]}' ,\n\t\t`routers`='{$_POST["routers"]}',\n\t\t`domain-name-servers`='{$_POST["domain-name-servers"]}',\n\t\t`domain-name-servers-2`='{$_POST["domain-name-servers2"]}',\n\t\t`domain`='{$_POST["domain"]}'\n\t\tWHERE mac='{$_POST["edit-mac"]}'"; $q = new mysql(); $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo $q->mysql_error; return; } $cp = new computers(); $uid = $cp->ComputerIDFromMAC($_POST["edit-mac"]); if ($uid != null) { $cp = new computers($uid); $cp->ComputerIP = $_POST["ipaddr"]; $cp->ComputerRealName = $_POST["hostname"]; $cp->DnsZoneName = $_POST["domain"]; $cp->ComputerMacAddress = $_POST["edit-mac"]; $cp->Edit(); } if (!isset($GLOBALS["APPLY_DHCP"])) { $GLOBALS["APPLY_DHCP"] = true; $sock = new sockets(); $sock->getFrameWork("cmd.php?apply-dhcpd=yes"); } }
exit; } if (isset($_GET["modify-dhcpd-settings-popup"])) { host_edit_popup(); exit; } if (isset($_GET["modify-dhcpd-settings-tab"])) { host_edit_tabs(); exit; } if (isset($_GET["modify-dhcpd-advoptions-popup"])) { host_edit_options(); exit; } if (isset($_POST["new-mac"])) { host_new(); exit; } if (isset($_POST["edit-mac"])) { host_edit(); exit; } if (isset($_POST["host-delete"])) { hosts_delete(); exit; } if (isset($_POST["host-add"])) { host_add(); exit; } if (isset($_POST["edit-mac-adv"])) {