diff --git a/inc/spbc-tools.php b/inc/spbc-tools.php index 6eba9fd0b..e39694642 100644 --- a/inc/spbc-tools.php +++ b/inc/spbc-tools.php @@ -589,7 +589,7 @@ function spbc_get_brief_data_for_firewalls($current_fw_data, $current_bfp_data, // get new records of all types $new_log_data = array(); - $fw_data_query = 'SELECT entry_timestamp as ts, status, requests' . + $fw_data_query = 'SELECT entry_timestamp as ts, status' . ' FROM ' . SPBC_TBL_FIREWALL_LOG // exclude too old . ' WHERE entry_timestamp > (UNIX_TIMESTAMP() - ' . ($days_limit * 3600 * 24) . ') AND' @@ -623,18 +623,18 @@ function spbc_get_brief_data_for_firewalls($current_fw_data, $current_bfp_data, // collect new events counters by type foreach ($new_log_data as $_entry => $value) { // skip wrong records - if (!isset($value['status'], $value['ts'], $value['requests'])) { + if (!isset($value['status'], $value['ts'])) { continue; } $day = date('Y-m-d', (int)$value['ts']); if ($value['status'] === 'DENY_BY_BFP') { - $count = in_array($day, array_keys($new_bfp_data)) ? $new_bfp_data[$day]['count'] + (int)$value['requests'] : (int)$value['requests']; + $count = in_array($day, array_keys($new_bfp_data)) ? $new_bfp_data[$day]['count'] + 1 : 1; $new_bfp_data[$day] = array('day' => $day, 'count' => $count); } else { - $count = in_array($day, array_keys($new_fw_data)) ? $new_fw_data[$day]['count'] + (int)$value['requests'] : (int)$value['requests']; + $count = in_array($day, array_keys($new_fw_data)) ? $new_fw_data[$day]['count'] + 1 : 1; $new_fw_data[$day] = array('day' => $day, 'count' => $count); }