blob: fd5246a927bd10ae96f4ba481018946dadc35777 (
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
35
36
37
38
39
40
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>
|