CZI_presence_detector/public/index.php
2023-08-12 18:15:25 +02:00

49 lines
No EOL
1.6 KiB
PHP

<?php
$page_title = 'CZI Presence Detector';
$present_file = 'present.json';
$present = json_decode(file_get_contents($present_file), true);
$tz = 'Europe/Berlin';
$datetime = new DateTime("now", new DateTimeZone($tz));
$datetime->setTimestamp($present["timestamp"]);
?>
<html>
<head>
<title><?php echo $page_title; ?></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
<script src="bootstrap/js/bootstrap.bundle.min.js" integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script>
</head>
<body>
<nav class="navbar navbar-light bg-light justify-content-between" style="padding: 0">
<span class="navbar-brand mb-0 h1" style="padding-left: 1rem"><?php echo $page_title; ?></span>
</nav>
<div id="content" style="padding: 2rem;">
<h2>Jetzt gerade im CZI <small>(letztes Update von <?php echo $datetime->format('H:i:s d.m.Y'); ?>)</small></h2><br>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>MAC</th>
</tr>
</thead>
<?php
foreach ($present["identities"] as $identity) {
?>
<tr>
<td><?php echo $identity["name"]; ?></td>
<td><code><?php echo $identity["mac"]; ?></code></td>
</tr>
<?php
}
?>
</table>
</div>
</body>
</html>