This commit is contained in:
Thijs Stobbelaar 2023-11-16 13:52:36 +01:00
parent 4a9076144a
commit 67738c1543
2 changed files with 5 additions and 6 deletions

View file

@ -10,7 +10,6 @@
"SquadKiller101", "SquadKiller101",
"Pettie1972", "Pettie1972",
"HeteKip", "HeteKip",
"Shepherders", "Shepherders"
"WackyJacky101"
] ]
} }

View file

@ -21,10 +21,10 @@ error_reporting(E_ALL);
$players_data = json_decode(file_get_contents('./data/player_lifetime_data.json'), true); $players_data = json_decode(file_get_contents('./data/player_lifetime_data.json'), true);
$selected_mode = isset($_POST['game_mode']) ? $_POST['game_mode'] : 'squad'; $selected_mode = isset($_GET['game_mode']) ? $_GET['game_mode'] : 'squad';
// Form to select game mode // Form to select game mode
echo "<form method='post' action=''> echo "<form method='get' action=''>
<input type='submit' name='game_mode' value='solo' class='btn'> <input type='submit' name='game_mode' value='solo' class='btn'>
<input type='submit' name='game_mode' value='duo' class='btn'> <input type='submit' name='game_mode' value='duo' class='btn'>
<input type='submit' name='game_mode' value='squad' class='btn'> <input type='submit' name='game_mode' value='squad' class='btn'>
@ -35,7 +35,7 @@ error_reporting(E_ALL);
</form><br>"; </form><br>";
// Buttons for each player // Buttons for each player
echo "<form method='post' action=''>"; echo "<form method='get' action=''>";
foreach ($players_data[$selected_mode] as $player_name => $player_details) { foreach ($players_data[$selected_mode] as $player_name => $player_details) {
echo "<button type='submit' name='selected_player' value='$player_name' class='btn' >$player_name</button>"; echo "<button type='submit' name='selected_player' value='$player_name' class='btn' >$player_name</button>";
@ -43,7 +43,7 @@ error_reporting(E_ALL);
echo "<input type='hidden' name='game_mode' value='$selected_mode'>"; echo "<input type='hidden' name='game_mode' value='$selected_mode'>";
echo "</form><br>"; echo "</form><br>";
$selected_player = $_POST['selected_player'] ?? array_key_first($players_data[$selected_mode]); $selected_player = $_GET['selected_player'] ?? array_key_first($players_data[$selected_mode]);
// Fetch the player stats based on game mode and selected player // Fetch the player stats based on game mode and selected player
if (isset($players_data[$selected_mode][$selected_player])) { if (isset($players_data[$selected_mode][$selected_player])) {