-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.php
73 lines (69 loc) · 2.86 KB
/
index.php
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
* Web-based RetroArch Netplay Room Browser.
*/
use RobLoach\LibretroNetplayRegistry\Registry;
// Autoload the required classes.
require __DIR__ . '/src/autoload.php';
// Load the entries from the registry.
$registry = new Registry();
$entries = $registry->selectAll();
// Construct the lobby contents.
$contents = '';
if (empty($entries)) {
$contents = '<div class="alert alert-info" role="alert">There are currently no lobbies open.</div>';
} else {
// Table header.
$contents = '<table class="table"><thead><tr><th>Username</th><th>Game</th><th>Core</th></thead><tbody>';
// Loop through every row.
foreach ($entries as $entry) {
$contents .= "<tr><th>{$entry['username']}</th>";
$contents .= "<td>{$entry['gamename']}</td>";
$contents .= "<td>{$entry['corename']}</td></tr>";
}
// Table footer.
$contents .= '</tbody></table>';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>RetroArch Lobby Browser</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css"
integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ"
crossorigin="anonymous">
<link rel="icon" href="https://www.libretro.com/wp-content/uploads/2016/01/ic_launcher.png" sizes="32x32"/>
<link rel="icon" href="https://www.libretro.com/wp-content/uploads/2016/01/ic_launcher.png" sizes="192x192"/>
<link rel="apple-touch-icon-precomposed" href="https://www.libretro.com/wp-content/uploads/2016/01/ic_launcher.png"/>
</head>
<body>
<div class="container">
<div class="jumbotron">
<h1 class="display-4">RetroArch Lobby Browser</h1>
<p class="lead">Currently available netplay rooms in <a href="http://libretro.com">RetroArch</a>.</p>
<hr class="my-4">
<p class="lead">
<a class="btn btn-primary btn-lg"
href="https://www.libretro.com/" role="button">RetroArch</a>
<a class="btn btn-info btn-lg"
href="https://www.youtube.com/watch?v=oh7hhoOBg54" role="button">How to Join</a>
<a class="btn btn-info btn-lg"
href="https://www.youtube.com/watch?v=n6aF0wNcm7E" role="button">How to Host</a>
</p>
</div>
<?php
echo $contents;
?>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"></script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"
integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn"
crossorigin="anonymous"></script>
</body>
</html>