summaryrefslogtreecommitdiff
path: root/computer-time-limit.php
diff options
context:
space:
mode:
Diffstat (limited to 'computer-time-limit.php')
-rw-r--r--computer-time-limit.php8
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 . ',' .