diff --git a/ajax/bandwidth/get_bandwidth.php b/ajax/bandwidth/get_bandwidth.php index db9ebfe8..04c1fc03 100644 --- a/ajax/bandwidth/get_bandwidth.php +++ b/ajax/bandwidth/get_bandwidth.php @@ -42,10 +42,10 @@ $jsonobj = json_decode($jsonstdoutvnstat[0], true); $timeunits = filter_input(INPUT_GET, 'tu'); if ($timeunits === 'm') { // months - $jsonData = $jsonobj['interfaces'][0]['traffic']['months']; + $jsonData = $jsonobj['interfaces'][0]['traffic']['month']; } else { // default: days - $jsonData = $jsonobj['interfaces'][0]['traffic']['days']; + $jsonData = $jsonobj['interfaces'][0]['traffic']['day']; } $datasizeunits = filter_input(INPUT_GET, 'dsu'); diff --git a/ajax/bandwidth/get_bandwidth_hourly.php b/ajax/bandwidth/get_bandwidth_hourly.php index 82c5d9ad..a8e0f5cc 100644 --- a/ajax/bandwidth/get_bandwidth_hourly.php +++ b/ajax/bandwidth/get_bandwidth_hourly.php @@ -42,8 +42,8 @@ if (filter_input(INPUT_GET, 'tu') == 'h') { $jsonobj = json_decode($jsonstdoutvnstat[0], true)['interfaces'][0]; $jsonData = $jsonobj['traffic']['hour']; for ($i = count($jsonData) - 1; $i >= 0; --$i) { - $data_template[$jsonData[$i]['id']]['rx'] = round($jsonData[$i]['rx'] / 1024, 0); - $data_template[$jsonData[$i]['id']]['tx'] = round($jsonData[$i]['tx'] / 1024, 0); + $data_template[$jsonData[$i]['time']['hour']]['rx'] = round($jsonData[$i]['rx'] / 1024, 0); + $data_template[$jsonData[$i]['time']['hour']]['tx'] = round($jsonData[$i]['tx'] / 1024, 0); } $data = array();