diff --git a/html/includes/table/syslog.inc.php b/html/includes/table/syslog.inc.php index e06648b3a..11c2b9ce7 100644 --- a/html/includes/table/syslog.inc.php +++ b/html/includes/table/syslog.inc.php @@ -1,40 +1,40 @@ = ? AND '; + $where .= ' AND timestamp >= ?'; $param[] = $_POST['from']; } if (!empty($_POST['to'])) { - $where .= 'timestamp <= ? AND '; + $where .= ' AND timestamp <= ?'; $param[] = $_POST['to']; } if ($_SESSION['userlevel'] >= '5') { $sql = 'FROM syslog AS S'; - $sql .= ' WHERE '.$where . '1'; + $sql .= ' WHERE '.$where; } else { $sql = 'FROM syslog AS S, devices_perms AS P '; $sql .= 'WHERE S.device_id = P.device_id AND P.user_id = ? AND '; - $sql .= $where . "1"; + $sql .= $where; $param = array_merge(array($_SESSION['user_id']), $param); } @@ -61,7 +61,6 @@ if ($rowCount != -1) { $sql = "SELECT S.*, DATE_FORMAT(timestamp, '".$config['dateformat']['mysql']['compact']."') AS date $sql"; - foreach (dbFetchRows($sql, $param) as $syslog) { $dev = device_by_id_cache($syslog['device_id']); $response[] = array( @@ -77,6 +76,5 @@ $output = array( 'rowCount' => $rowCount, 'rows' => $response, 'total' => $total, -'sql' => $sql, ); echo _json_encode($output);