From fbb81b8d794b7c2641724eeb4f4aee696cdaaed8 Mon Sep 17 00:00:00 2001 From: magmaus3 Date: Fri, 14 Jul 2023 13:27:35 +0200 Subject: [PATCH] add license, make php source more readable, add source code link, etc. --- README.md | 21 +++++++++++++++- index.css | 12 ++++++++- index.php | 73 ++++++++++++++++++++++++++++++++----------------------- 3 files changed, 73 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index b5e59b9..97a955f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,24 @@ # Simple active room listing for Project Gungame -Warning: I don't know how to program in php, and the script's source might be the worst thing you ever seen. +Warning: I don't know how to program in php, +and the script's source might be the worst thing you ever seen. Source code is available at [magmaus3/projectgungame-roomviewer-php](https://git.magmaus3.eu.org/magmaus3/projectgungame-roomviewer-php) + +## License + +``` +Copyright 2023 magmaus3 + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` diff --git a/index.css b/index.css index e986b7e..c9aba77 100644 --- a/index.css +++ b/index.css @@ -4,7 +4,17 @@ body { justify-content: center; background-color: #20202a; color: white; - font-family: sans-serif; + font-family: monospace; +} + +a, a:visited { + color: cyan; + text-decoration: none; +} + +footer { + display: flex; + margin-top: 2em; } table { diff --git a/index.php b/index.php index 5931b61..16e862c 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,20 @@ - + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +array( 'method'=>"GET", @@ -11,6 +26,7 @@ $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); +parse_str($data, $arr); ?> @@ -23,11 +39,7 @@ $data = file_get_contents("http://pgg-server.glitch.me/scripts/getrooms.php", fa

List of active games.

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.

- Request failed. You may want to try to reload the page"; -} else { - echo " +
- "; - - parse_str($data, $arr); - if ($arr['cant'] != "0") { - foreach (range(0, $arr['cant']-1) as $i) { - $i = strval($i); - echo " - - - - - - - - - "; - }; - } else { - echo " + + + + + + + + + + + + + + + - "; - } - echo " + +
Name Players @@ -37,34 +49,33 @@ if ($data == false) { Country Gamemode
" . $arr["roomname$i"] . "" . $arr["players$i"] . "/" . $arr["maxplayers$i"] ."idk" . $arr["pvp$i"] . "" . $arr["edit$i"]. "" . $arr["country$i"] . "" . $arr["gamemode$i"] . "
idk
No active games
-"; -} -?> +