From d6a0ad0bc30f6044fa34013472d2e4ae22b12988 Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 14 Nov 2023 22:20:42 +0100 Subject: [PATCH] matchinfo --- matchinfo.php | 81 +++++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/matchinfo.php b/matchinfo.php index 23ca551..04a55a4 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -37,52 +37,57 @@ $lastMatches = array_slice($allMatches, 0, 8);

Latest Matches

- - - - - - - - - - - - - "; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - } + // Check if the JSON file for the given match ID exists + if (file_exists($filename)) { + // Read and decode the JSON file + $jsonData = json_decode(file_get_contents($filename), true); + $matchinfo = $jsonData['data']['attributes']; + $matchdata = $jsonData['data'] + echo "
Player NameKillsDamage DealtTime SurvivedRank
" . htmlspecialchars($playerStats['name']) . "" . htmlspecialchars($playerStats['kills']) . "" . htmlspecialchars($playerStats['damageDealt']) . "" . htmlspecialchars($playerStats['timeSurvived']) . "" . htmlspecialchars($playerStats['winPlace']) . "
"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo "
matchTypedurationgameModemapNamecreatedAtid
" . htmlspecialchars($matchinfo['matchType']) . "" . htmlspecialchars($matchinfo['duration']) . "" . htmlspecialchars($matchinfo['gameMode']) . "" . htmlspecialchars($matchinfo['mapName']) . "" . htmlspecialchars($matchinfo['createdAt']) . "" . htmlspecialchars($$matchdata['id']) . "
"; + + + echo ""; + + foreach ($jsonData['included'] as $includedItem) { + if ($includedItem['type'] == "participant") { + $playerStats = $includedItem['attributes']['stats']; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; } - - echo "
Player NameKillsDamage DealtTime SurvivedRank
" . htmlspecialchars($playerStats['name']) . "" . htmlspecialchars($playerStats['kills']) . "" . htmlspecialchars($playerStats['damageDealt']) . "" . htmlspecialchars($playerStats['timeSurvived']) . "" . htmlspecialchars($playerStats['winPlace']) . "
"; - } else { - echo "JSON file not found for the given match ID."; } + + echo ""; } else { - echo "No match ID provided."; + echo "JSON file not found for the given match ID."; } - ?> + } else { + echo "No match ID provided."; + } + ?>