diff options
author | Erich Eckner <git@eckner.net> | 2024-02-05 19:51:21 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2024-02-05 19:51:21 +0100 |
commit | 6feac56cad562e1e05d33f9d2c551bd7a09b93bf (patch) | |
tree | 954c1b150bda1dadd1299012e62cc8f3c5add033 /computer-time-limit.php | |
parent | b9cea121a43244138826c08a582336e74a3f39db (diff) | |
download | computer-time-limit-6feac56cad562e1e05d33f9d2c551bd7a09b93bf.tar.xz |
computer-time-limit.php: add logging
Diffstat (limited to 'computer-time-limit.php')
-rw-r--r-- | computer-time-limit.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/computer-time-limit.php b/computer-time-limit.php index 7cc57fb..e673e52 100644 --- a/computer-time-limit.php +++ b/computer-time-limit.php @@ -2,6 +2,12 @@ $db = new SQLite3('../backstage/computer-time-limit/computer-time-limit.sqlite'); +function log_to_file($line) { + $handle = fopen('../backstage/computer-time-limit/log', 'w+'); + fwrite($handle, $line . "\n"); + fclose($handle); +} + if (array_key_exists('msg', $_POST) && array_key_exists('sig', $_POST)) { $sig_file = tempnam('/tmp', 'ctl-sig'); @@ -35,6 +41,7 @@ if (array_key_exists('msg', $_POST) && array_key_exists('sig', $_POST)) { $aktiv = $row['aktiv']; $bis = strtotime($row['bis']); $von = strtotime($row['von']); + log_to_file('from_db ' . $key . ' ' . $_POST['msg'] . ' ' . $aktiv . ' ' . $von . ' ' . $bis); if ($bis < $von) { $aktiv = 0; $bis = $von; @@ -69,6 +76,7 @@ if (array_key_exists('msg', $_POST) && array_key_exists('sig', $_POST)) { if ($noch == 0) { $aktiv = 0; } + log_to_file('to_db ' . $key . ' ' . $aktiv . ' ' . $von . ' ' . $bis); $db -> exec( 'UPDATE `computer_time`' . ' SET `aktiv`=' . $aktiv . ',' . |