init
This commit is contained in:
commit
b9210e5965
2 changed files with 118 additions and 0 deletions
70
index.php
Normal file
70
index.php
Normal file
|
@ -0,0 +1,70 @@
|
|||
<!DOCTYPE html>
|
||||
<?php
|
||||
$opts = array(
|
||||
'http'=>array(
|
||||
'method'=>"GET",
|
||||
'header'=>"User-Agent: pgg-room-viewer_php +mailto:magmaus3@disroot.org \r\n"
|
||||
)
|
||||
);
|
||||
|
||||
$context = stream_context_create($opts);
|
||||
|
||||
// Here you can change the URL of the server
|
||||
$data = file_get_contents("http://pgg-server.glitch.me/scripts/getrooms.php", false, $context);
|
||||
?>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title></title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="/index.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<h1>List of active games.</h1>
|
||||
<h2>Note that if a person exits their flash player without exiting the room first,
|
||||
the room will be visible on the list but it'll be impossible to join it.</h2>
|
||||
<?php
|
||||
if ($data == false) {
|
||||
echo "<div class='error'>Request failed. You may want to try to reload the page</div>";
|
||||
} else {
|
||||
echo "<table>
|
||||
<thead>
|
||||
<th>Name</td>
|
||||
<th>Players</td>
|
||||
<th>Password</td>
|
||||
<th>PvP</td>
|
||||
<th>Edit</td>
|
||||
<th>Country</td>
|
||||
<th>Gamemode</td>
|
||||
</thead>
|
||||
<tbody>";
|
||||
|
||||
parse_str($data, $arr);
|
||||
if ($arr['cant'] != "0") {
|
||||
foreach (range(0, $arr['cant']-1) as $i) {
|
||||
$i = strval($i);
|
||||
echo "
|
||||
<tr>
|
||||
<td class='roomname'>" . $arr["roomname$i"] . "</td>
|
||||
<td class='players'>" . $arr["players$i"] . "/" . $arr["maxplayers$i"] ."</td>
|
||||
<td class='passwd'>idk</td>
|
||||
<td class='pvp'>" . $arr["pvp$i"] . "</td>
|
||||
<td class='edit'>" . $arr["edit$i"]. "</td>
|
||||
<td class='country'>" . $arr["country$i"] . "</td>
|
||||
<td class='gamemode'>" . $arr["gamemode$i"] . "</td>
|
||||
</tr>";
|
||||
};
|
||||
} else {
|
||||
echo "
|
||||
<tr>
|
||||
<td colspan=7 class='nogames'>No active games</td>
|
||||
</tr>";
|
||||
}
|
||||
echo "
|
||||
</tbody>
|
||||
</table>
|
||||
";
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue