matchinfo

This commit is contained in:
Thijs Stobbelaar 2023-11-14 22:27:01 +01:00
parent 936e4c7aa6
commit 3ba34fbe51
2 changed files with 27 additions and 15 deletions

View file

@ -7,16 +7,17 @@ error_reporting(E_ALL);
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<?php include './includes/head.php'; ?> <?php include './includes/head.php'; ?>
<body> <body>
<?php include './includes/navigation.php'; ?> <?php include './includes/navigation.php'; ?>
<header> <header>
<img src="./images/banner2.png" alt="banner" class="banner"> <img src="./images/banner2.png" alt="banner" class="banner">
</header> </header>
<main> <main>
<section> <section>
<h2>Match Stats</h2> <h2>Match Stats</h2>
<?php <?php
include './config/config.php'; include './config/config.php';
$players_matches = json_decode(file_get_contents('./data/player_matches.json'), true); $players_matches = json_decode(file_get_contents('./data/player_matches.json'), true);
@ -29,7 +30,7 @@ error_reporting(E_ALL);
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>";
} }
} }
echo "</form><br>"; echo "</form><br>";
$selected_player = $_GET['selected_player'] ?? $players_matches[0]['playername']; $selected_player = $_GET['selected_player'] ?? $players_matches[0]['playername'];
@ -64,17 +65,28 @@ error_reporting(E_ALL);
$damage = number_format($match['stats']['damageDealt'], 0, '.', ''); $damage = number_format($match['stats']['damageDealt'], 0, '.', '');
$timeSurvived = $match['stats']['timeSurvived']; $timeSurvived = $match['stats']['timeSurvived'];
$winPlace = $match['stats']['winPlace']; $winPlace = $match['stats']['winPlace'];
echo "<tr><td>$formattedDate</td><td>$gameMode</td><td>$matchType</td><td>$mapName</td><td>$kills</td><td>$damage</td><td>$timeSurvived</td><td>$winPlace</td></tr>"; echo "<tr>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $formattedDate . "</a></td>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $gameMode . "</a></td>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $matchType . "</a></td>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $mapName . "</a></td>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $kills . "</a></td>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $damage . "</a></td>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $timeSurvived . "</a></td>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $winPlace . "</a></td>
</tr>";
} }
echo "</table><br>"; echo "</table><br>";
} }
} }
?> ?>
</section> </section>
</main> </main>
<?php include './includes/footer.php'; ?> <?php include './includes/footer.php'; ?>
</body> </body>
</html>
</html>

View file

@ -59,7 +59,7 @@ $lastMatches = array_slice($allMatches, 0, 8);
echo "<td>" . htmlspecialchars($matchinfo['gameMode']) . "</td>"; echo "<td>" . htmlspecialchars($matchinfo['gameMode']) . "</td>";
echo "<td>" . htmlspecialchars($matchinfo['mapName']) . "</td>"; echo "<td>" . htmlspecialchars($matchinfo['mapName']) . "</td>";
echo "<td>" . htmlspecialchars($matchinfo['createdAt']) . "</td>"; echo "<td>" . htmlspecialchars($matchinfo['createdAt']) . "</td>";
echo "<td>" . htmlspecialchars($$matchdata['id']) . "</td>"; echo "<td>" . htmlspecialchars($matchdata['id']) . "</td>";
echo "</tr>"; echo "</tr>";
echo "</table>"; echo "</table>";