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)) { $run_cmd = "/opt/Eye/scripts/dnsmasq-hook.sh '".$dhcp_action."' '".$mac."' '".$ip."' '".$dhcp_hostname."'"; $result = shell_exec("/usr/bin/sudo ".escapeshellcmd($run_cmd)." >/dev/null 2>/dev/null &"); LOG_VERBOSE($db_link, "Run command: $run_cmd "); } else { LOG_ERROR($db_link, "$ip - wrong network!"); } } } } else { LOG_WARNING($db_link,"API: Unknown request"); } unset($_GET); unset($_POST); ?>