diff --git a/matchinfo.php b/matchinfo.php
index 311fab7..0ca7865 100644
--- a/matchinfo.php
+++ b/matchinfo.php
@@ -1,38 +1,92 @@
";
- echo "
| Player Name | Kills | Damage Dealt | Time Survived | Rank |
";
-
- // Loop through the JSON data to extract player stats
-
- foreach ($jsonData['included'] as $includedItem) {
- if ($includedItem['type'] == "participant"){
- $playerStats = $includedItem['attributes']['stats'];
- echo "";
- echo "| " . htmlspecialchars($playerStats['name']) . " | ";
- echo "" . htmlspecialchars($playerStats['kills']) . " | ";
- echo "" . htmlspecialchars($playerStats['damageDealt']) . " | ";
- echo "" . htmlspecialchars($playerStats['timeSurvived']) . " | ";
- echo "" . htmlspecialchars($playerStats['winPlace']) . " | ";
- echo "
";
- }
- }
-
- echo "";
- } else {
- echo "JSON file not found for the given match ID.";
+// Combine matches from all players
+$allMatches = [];
+foreach ($playersData as $player) {
+ foreach ($player['player_matches'] as $match) {
+ $match['playername'] = $player['playername']; // Add playername to each match for reference
+ $allMatches[] = $match;
}
-} else {
- echo "No match ID provided.";
}
-?>
\ No newline at end of file
+
+// Sort matches by createdAt date
+usort($allMatches, function ($a, $b) {
+ return strtotime($b['createdAt']) - strtotime($a['createdAt']);
+});
+
+// Get the last 5 matches
+$lastMatches = array_slice($allMatches, 0, 8);
+
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Latest Matches
+
+
+
+
+
+
| Player Name | Kills | Damage Dealt | Time Survived | Rank |
+
+
+
+ ";
+ echo "" . htmlspecialchars($playerStats['name']) . " | ";
+ echo "" . htmlspecialchars($playerStats['kills']) . " | ";
+ echo "" . htmlspecialchars($playerStats['damageDealt']) . " | ";
+ echo "" . htmlspecialchars($playerStats['timeSurvived']) . " | ";
+ echo "" . htmlspecialchars($playerStats['winPlace']) . " | ";
+ echo "";
+ }
+ }
+
+ echo "
";
+ } else {
+ echo "JSON file not found for the given match ID.";
+ }
+ } else {
+ echo "No match ID provided.";
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file