From 0596643b553c48cfd68474c8d8bf5a673dcb9f76 Mon Sep 17 00:00:00 2001 From: Neil Lathwood Date: Wed, 18 Feb 2015 16:22:52 +0000 Subject: [PATCH] Fixed sql query for port stats call to include the device_id :/ --- html/includes/api_functions.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/html/includes/api_functions.inc.php b/html/includes/api_functions.inc.php index fb25c96cce..d1921c9bdb 100644 --- a/html/includes/api_functions.inc.php +++ b/html/includes/api_functions.inc.php @@ -76,8 +76,10 @@ function get_port_stats_by_port_hostname() global $config; $app = \Slim\Slim::getInstance(); $router = $app->router()->getCurrentRoute()->getParams(); + $hostname = $router['hostname']; + $device_id = ctype_digit($hostname) ? $hostname : getidbyname($hostname); $ifName = urldecode($router['ifname']); - $stats = dbFetchRow("SELECT * FROM `ports` WHERE `ifName`=?", array($ifName)); + $stats = dbFetchRow("SELECT * FROM `ports` WHERE `device_id`=? AND `ifName`=?", array($device_id,$ifName)); $output = array("status" => "ok", "port" => $stats); $app->response->headers->set('Content-Type', 'application/json'); echo _json_encode($output);