summaryrefslogtreecommitdiff
path: root/computer-time-limit.php
blob: a6372a1b319810ca7afa152410620890feb07aab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php

$db = new SQLite3('../backstage/computer-time-limit.sqlite');

if (array_key_exists('gpg', $_POST)) {
  print(shell_exec('echo "' . base64_encode($_POST['gpg']) .'" | base64 -d | gpg --verify 2>&1'));
  die();
}

$result = $db->query('select * from `computer_time`');

?><html><body><table><?php

while ($row = $result->fetchArray()) {

  $bis = strtotime($row['bis']);
  $von = strtotime($row['von']);
  if ($row['aktiv']) {
    $von = time();
  }
  $noch = $bis - $von;

  ?><tr><td><?php print($row['name']); ?></td><td><?php

  print(date('Y-m-d H:i:s', $bis));
  print(' (');
  print($noch);
  print(')');

  ?></td></tr>
  <?php
}

?></table></body></html>