diff --git a/functions.php b/functions.php index 9a36de2..02c79be 100644 --- a/functions.php +++ b/functions.php @@ -136,6 +136,14 @@ class LightStatus { } } + public function setClientLastSeen() { + $this->times['clientLastSeen'] = time(); + $this->saveTimes(); + } + public function getClientLastSeen() { + return $this->times['clientLastSeen']; + } + private function readTimes() { diff --git a/index.php b/index.php index a86ff43..31401e6 100644 --- a/index.php +++ b/index.php @@ -12,6 +12,9 @@ $light->update(); $error_string = ""; +$lastSeenTimeStr = date("H:i:s, Y-m-d",($light->getClientLastSeen())); +$lastSeenTimeDiff = (time()-$light->getClientLastSeen()); + // route actions if (isset($_GET['action'])) { if ($_GET['action'] == 'enlighten') { @@ -66,7 +69,7 @@ if (isset($_GET['action'])) { - + @@ -103,6 +106,10 @@ if (isset($_GET['action'])) { Nacht (ja/nein):isNight) ? "ja" : "nein" ?> + + Client Last Seen:; + vor  Min:Sek +

Einstellungen

@@ -128,7 +135,9 @@ if (isset($_GET['action'])) { - +
+
+
diff --git a/service.php b/service.php index 03a9f0d..8206db6 100644 --- a/service.php +++ b/service.php @@ -9,6 +9,7 @@ include "functions.php"; $light = new LightStatus(); $light->update(); +$light->setClientLastSeen(); echo $light; ?> diff --git a/style.css b/style.css index f30cb52..ffecb00 100644 --- a/style.css +++ b/style.css @@ -14,6 +14,9 @@ table { margin-top: 1em; margin-bottom: 1em; } +table tr td { + vertical-align: top; +} table tr>td:first-child { padding-right: 0.75em; text-align: right;