summaryrefslogtreecommitdiffstats
path: root/apis
diff options
context:
space:
mode:
authorSimon Rettberg2016-02-19 15:00:23 +0100
committerSimon Rettberg2016-02-19 15:00:23 +0100
commit4ce42f5e17e600dbb74037e0b9bf9a071674d220 (patch)
treea4da352519900434dbe54ac27a89aef32b0b2867 /apis
parent[trigger] detect server ip: Ignore IPv6 (diff)
downloadslx-admin-4ce42f5e17e600dbb74037e0b9bf9a071674d220.tar.gz
slx-admin-4ce42f5e17e600dbb74037e0b9bf9a071674d220.tar.xz
slx-admin-4ce42f5e17e600dbb74037e0b9bf9a071674d220.zip
[clientlog] Sanity checks for timestamps
Diffstat (limited to 'apis')
-rw-r--r--apis/clientlog.inc.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/apis/clientlog.inc.php b/apis/clientlog.inc.php
index c48fcdb0..9c261731 100644
--- a/apis/clientlog.inc.php
+++ b/apis/clientlog.inc.php
@@ -64,7 +64,7 @@ if ($type{0} === '~') {
// See if we have a lingering session, create statistic entry if so
if ($old !== false && $old['logintime'] !== 0) {
$sessionLength = $old['lastseen'] - $old['logintime'];
- if ($sessionLength > 0) {
+ if ($sessionLength > 0 && $sessionLength < 86400*2) {
$start = $old['logintime'];
if ($start === 0) $start = $NOW;
Database::exec('INSERT INTO statistic (dateline, typeid, machineuuid, clientip, username, data)'
@@ -78,7 +78,7 @@ if ($type{0} === '~') {
}
// Write poweroff period length to statistic table
if ($old !== false) {
- $lastSeen = $old['lastseen'] + 300;
+ $lastSeen = $old['lastseen'] + 500;
$offtime = ($NOW - $uptime) - $lastSeen;
if ($offtime > 600 && $offtime < 86400 * 90) {
Database::exec('INSERT INTO statistic (dateline, typeid, machineuuid, clientip, username, data)'
@@ -101,7 +101,7 @@ if ($type{0} === '~') {
. ' macaddr = VALUES(macaddr),'
. ' clientip = VALUES(clientip),'
. ' lastseen = VALUES(lastseen),'
- . ($uptime < 120 ? ' logintime = 0,' : '')
+ . ($uptime < 180 ? ' logintime = 0,' : '')
. ' lastboot = VALUES(lastboot),'
. ' realcores = VALUES(realcores),'
. ' mbram = VALUES(mbram),'
@@ -164,7 +164,7 @@ if ($type{0} === '~') {
}
}
// 9) Log last session length if applicable
- if ($sessionLength > 0) {
+ if ($sessionLength > 0 && $sessionLength < 86400*2) {
$start = $old['logintime'];
if ($start === 0) $start = $NOW;
Database::exec('INSERT INTO statistic (dateline, typeid, machineuuid, clientip, username, data)'
@@ -178,7 +178,7 @@ if ($type{0} === '~') {
} elseif ($type === '~poweroff') {
if ($old !== false && (int)$old['logintime'] !== 0) {
$sessionLength = $old['lastseen'] - $old['logintime'];
- if ($sessionLength > 0) {
+ if ($sessionLength > 0 && $sessionLength < 86400*2) {
$start = $old['logintime'];
if ($start === 0) $start = $NOW;
Database::exec('INSERT INTO statistic (dateline, typeid, clientip, username, data)'