commit
1b56b0cc9d
1 changed files with 75 additions and 1 deletions
76
index.php
76
index.php
|
|
@ -1,3 +1,27 @@
|
|||
<?php
|
||||
// Read the JSON file
|
||||
$jsonData = file_get_contents('data/player_matches.json');
|
||||
$playersData = json_decode($jsonData, true);
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
|
@ -16,7 +40,57 @@
|
|||
|
||||
<main>
|
||||
<section>
|
||||
<h2>Welcome to DTCH - PUBG Clan</h2>
|
||||
<h2>Latest Matches</h2>
|
||||
|
||||
<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
|
||||
$mapNames = array(
|
||||
"Baltic_Main" => "Erangel",
|
||||
"Chimera_Main" => "Paramo",
|
||||
"Desert_Main" => "Miramar",
|
||||
"DihorOtok_Main" => "Vikendi",
|
||||
"Erangel_Main" => "Erangel",
|
||||
"Heaven_Main" => "Haven",
|
||||
"Kiki_Main" => "Deston",
|
||||
"Range_Main" => "Camp Jackal",
|
||||
"Savage_Main" => "Sanhok",
|
||||
"Summerland_Main" => "Karakin",
|
||||
"Tiger_Main" => "Taego"
|
||||
);
|
||||
|
||||
foreach($lastMatches as $match) {
|
||||
?>
|
||||
<tr>
|
||||
<!-- <td><?php echo date("Y-m-d", strtotime($match['createdAt'])); ?></td> -->
|
||||
<td><?php echo $match['playername']; ?></td>
|
||||
<td><?php echo $match['gameMode']; ?></td>
|
||||
<td><?php echo $match['matchType']; ?></td>
|
||||
<td><?php echo isset($mapNames[$match['mapName']]) ? $mapNames[$match['mapName']] : $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>
|
||||
|
||||
<p>Join us on our Discord:</p>
|
||||
<a href="https://discord.gg/wMXsB3ZmNA" target="_blank" rel="noopener noreferrer">
|
||||
<img src="./media/discordlogo.png" alt="Discord Logo" class="discord-logo">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue