diff options
Diffstat (limited to 'web/index.php')
| -rw-r--r-- | web/index.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/web/index.php b/web/index.php new file mode 100644 index 0000000..fd5246a --- /dev/null +++ b/web/index.php @@ -0,0 +1,41 @@ +<?php +include_once $_SERVER['DOCUMENT_ROOT'] . '/config.php'; + +$db = new PDO(DB_URL, DB_USER, DB_PASS); + +$stmt = $db->query('SELECT name FROM rooms ORDER BY joined_at, departed_at DESC'); +$stmt->execute(); +$rooms = $stmt->fetchAll(PDO::FETCH_ASSOC); +?> +<!DOCTYPE html> +<html> + +<head> + <title>Index - <?= INSTANCE_NAME ?></title> + <link rel="stylesheet" href="/static/style.css"> + <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"> +</head> + +<body> + <?php if (isset($rooms)): ?> + <h1>Index of <?= INSTANCE_NAME ?></h1> + <?php if (empty($rooms)): ?> + <p>There are no rooms. <a href="/mod/">Add one!</a></p> + <?php else: ?> + <table> + <tr> + <th>Room</th> + <th>Last message</th> + </tr> + <?php foreach ($rooms as $r): ?> + <tr> + <td><a href="/?c=<?= $r['name'] ?>"><?= $r['name'] ?></a></td> + <td><?= '1 minute ago' ?></td> + </tr> + <?php endforeach; ?> + </table> + <?php endif; ?> + <?php endif; ?> +</body> + +</html>
\ No newline at end of file |
