matchinfo

This commit is contained in:
Lanta 2023-11-14 22:20:42 +01:00
parent d87267f5cf
commit d6a0ad0bc3

View file

@ -37,18 +37,7 @@ $lastMatches = array_slice($allMatches, 0, 8);
<section>
<h2>Latest Matches</h2>
<table class='sortable'>
<tr>
<!-- <th>Match Date</th> -->
<th>Player Name</th>
<th>Kills</th>
<th>Damage Dealt</th>
<th>Time Survived</th>
<th>Rank</th>
</tr>
<?php
@ -61,6 +50,22 @@ $lastMatches = array_slice($allMatches, 0, 8);
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 "<table class='sortable'><tr><th>matchType</th><th>duration</th><th>gameMode</th><th>mapName</th><th>createdAt</th><th>id</th></tr>";
echo "<tr>";
echo "<td>" . htmlspecialchars($matchinfo['matchType']) . "</td>";
echo "<td>" . htmlspecialchars($matchinfo['duration']) . "</td>";
echo "<td>" . htmlspecialchars($matchinfo['gameMode']) . "</td>";
echo "<td>" . htmlspecialchars($matchinfo['mapName']) . "</td>";
echo "<td>" . htmlspecialchars($matchinfo['createdAt']) . "</td>";
echo "<td>" . htmlspecialchars($$matchdata['id']) . "</td>";
echo "</tr>";
echo "</table>";
echo "<table class='sortable'><tr><th>Player Name</th><th>Kills</th><th>Damage Dealt</th><th>Time Survived</th><th>Rank</th></tr>";
foreach ($jsonData['included'] as $includedItem) {
if ($includedItem['type'] == "participant") {