diff --git a/html/includes/table/syslog.inc.php b/html/includes/table/syslog.inc.php
index 987aac65a1..779fb23ac6 100644
--- a/html/includes/table/syslog.inc.php
+++ b/html/includes/table/syslog.inc.php
@@ -1,28 +1,28 @@
= ?';
+ $where .= 'timestamp >= ? AND ';
$param[] = $_POST['from'];
}
if (!empty($_POST['to'])) {
- $where .= ' AND timestamp <= ?';
+ $where .= 'timestamp <= ? AND ';
$param[] = $_POST['to'];
}
@@ -31,9 +31,9 @@ if ($_SESSION['userlevel'] >= '5') {
$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 = ?';
- $sql .= $where;
+ $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";
$param = array_merge(array($_SESSION['user_id']), $param);
}
@@ -60,6 +60,7 @@ 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(