show last matches on front page
This commit is contained in:
parent
534364f556
commit
e3ee038477
1 changed files with 49 additions and 0 deletions
49
index.php
49
index.php
|
|
@ -1,3 +1,14 @@
|
||||||
|
<?php
|
||||||
|
// Read the JSON file
|
||||||
|
$jsonData = file_get_contents('data/player_matches.json');
|
||||||
|
$playersData = json_decode($jsonData, true);
|
||||||
|
|
||||||
|
// Function to get the last 5 matches for a player
|
||||||
|
function getLastMatches($player) {
|
||||||
|
return array_slice($player['player_matches'], -5);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
|
@ -16,6 +27,44 @@
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<section>
|
<section>
|
||||||
|
|
||||||
|
<table border="1">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Match Date</th>
|
||||||
|
<th>Player Name</th>
|
||||||
|
<th>Game Mode</th>
|
||||||
|
<th>MatchType</th>
|
||||||
|
<th>Map</th>
|
||||||
|
<th>Kills</th>
|
||||||
|
<th>Damage Dealt</th>
|
||||||
|
<th>Time Survived</th>
|
||||||
|
<th>Win Place</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
foreach($playersData as $player) {
|
||||||
|
$matches = getLastMatches($player);
|
||||||
|
foreach($matches as $match) {
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo date("Y-m-d", strtotime($match['createdAt'])); ?></td>
|
||||||
|
<td><?php echo $player['playername']; ?></td>
|
||||||
|
<td><?php echo $match['gameMode']; ?></td>
|
||||||
|
<td><?php echo $match['matchType']; ?></td>
|
||||||
|
<td><?php echo $match['mapName']; ?></td>
|
||||||
|
<td><?php echo $match['stats']['kills']; ?></td>
|
||||||
|
<td><?php echo $match['stats']['damageDealt']; ?></td>
|
||||||
|
<td><?php echo gmdate("H:i:s", $match['stats']['timeSurvived']); ?></td>
|
||||||
|
<td><?php echo $match['stats']['winPlace']; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<h2>Welcome to DTCH - PUBG Clan</h2>
|
<h2>Welcome to DTCH - PUBG Clan</h2>
|
||||||
<p>Join us on our Discord:</p>
|
<p>Join us on our Discord:</p>
|
||||||
<a href="https://discord.gg/wMXsB3ZmNA" target="_blank" rel="noopener noreferrer">
|
<a href="https://discord.gg/wMXsB3ZmNA" target="_blank" rel="noopener noreferrer">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue