diff options
author | Simon Rettberg | 2015-05-21 17:16:23 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-05-21 17:16:23 +0200 |
commit | d7e270db5936913daba202a5e1e2c1e9ea7db9ee (patch) | |
tree | a4beeb9580784be1ebcc5000f59801ababdbc8ac /apis/clientlog.inc.php | |
parent | Another fix for AD SSL support (diff) | |
download | slx-admin-d7e270db5936913daba202a5e1e2c1e9ea7db9ee.tar.gz slx-admin-d7e270db5936913daba202a5e1e2c1e9ea7db9ee.tar.xz slx-admin-d7e270db5936913daba202a5e1e2c1e9ea7db9ee.zip |
Support statictics slxlog messages (Starting with '.'), those go to a special table
Diffstat (limited to 'apis/clientlog.inc.php')
-rw-r--r-- | apis/clientlog.inc.php | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/apis/clientlog.inc.php b/apis/clientlog.inc.php index bc235903..43f31917 100644 --- a/apis/clientlog.inc.php +++ b/apis/clientlog.inc.php @@ -13,11 +13,25 @@ if (isset($_POST['longdesc'])) $longdesc = $_POST['longdesc']; $row = Database::queryFirst('SELECT Count(*) AS cnt FROM clientlog WHERE clientip = :client AND dateline + 3600 > UNIX_TIMESTAMP()', array(':client' => $ip)); if ($row !== false && $row['cnt'] > 150) exit(0); -Database::exec('INSERT INTO clientlog (dateline, logtypeid, clientip, description, extra) VALUES (UNIX_TIMESTAMP(), :type, :client, :description, :longdesc)', array( - ':type' => $type, - ':client' => $ip, - ':description' => $description, - ':longdesc' => $longdesc, -)); + +if ($type{0} === '.' && preg_match('#^\[([^\]]+)\]\s*(.*)$#', $description, $out)) { + // Special case '.'-type: + Database::exec('INSERT INTO statistic (dateline, typeid, clientip, username, data) VALUES (UNIX_TIMESTAMP(), :type, :client, :username, :data)', array( + 'type' => $type, + 'client' => $ip, + 'username' => $out[1], + 'data' => $out[2], + )); + +} else { + + Database::exec('INSERT INTO clientlog (dateline, logtypeid, clientip, description, extra) VALUES (UNIX_TIMESTAMP(), :type, :client, :description, :longdesc)', array( + 'type' => $type, + 'client' => $ip, + 'description' => $description, + 'longdesc' => $longdesc, + )); +} + echo "OK.\n"; |