diff options
author | Erich Eckner <git@eckner.net> | 2024-01-09 20:44:42 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2024-01-09 20:44:42 +0100 |
commit | b9cea121a43244138826c08a582336e74a3f39db (patch) | |
tree | c54c1c8b62b5b337286765533a9d037794ed472f | |
parent | 7b79ed1ac2886672e9394de294d38ed8d6c19e2e (diff) | |
download | computer-time-limit-b9cea121a43244138826c08a582336e74a3f39db.tar.xz |
gegen negative Zeiten rüsten
-rw-r--r-- | computer-time-limit.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/computer-time-limit.php b/computer-time-limit.php index a00a9b1..7cc57fb 100644 --- a/computer-time-limit.php +++ b/computer-time-limit.php @@ -32,10 +32,15 @@ if (array_key_exists('msg', $_POST) && array_key_exists('sig', $_POST)) { print($key . ' is not known.'); die(); } + $aktiv = $row['aktiv']; $bis = strtotime($row['bis']); $von = strtotime($row['von']); + if ($bis < $von) { + $aktiv = 0; + $bis = $von; + } $bis = $bis + 30*60*(floor(time()/60/60/24) - floor($von/60/60/24)); - if ($row['aktiv']) { + if ($aktiv) { $von = time(); } $noch = $bis - $von; |