getMessage()); exit($exception->getMessage()); } } else { LOG_VERBOSE($db_link,"API: Not found."); } } else { LOG_VERBOSE($db_link,"API: not enough parameters"); } } //add dhcp log record if ($action ==='send_dhcp') { if (!empty($ip) and !empty($mac)) { $dhcp_hostname = ''; if (!empty($_GET["hostname"])) { $dhcp_hostname = trim($_GET["hostname"]); } if (!empty($_POST["hostname"])) { $dhcp_hostname = trim($_POST["hostname"]); } $faction = $_GET["action"] * 1; $dhcp_action = 'add'; if ($faction == 1) { $dhcp_action = 'add'; } if ($faction == 0) { $dhcp_action = 'del'; } LOG_VERBOSE($db_link, "API: external dhcp request for $ip [$mac] $dhcp_action"); if (checkValidIp($ip) and is_our_network($db_link, $ip)) { $new['action']=$dhcp_action; $new['mac']=$mac; $new['ip']=$ip; $new['dhcp_hostname']=$dhcp_hostname; insert_record($db_link,"dhcp_queue",$new); } else { LOG_ERROR($db_link, "$ip - wrong network!"); } } } } else { LOG_WARNING($db_link,"API: Unknown request"); } unset($_GET); unset($_POST); logout($db_link,TRUE); ?>