last stats

This commit is contained in:
Lanta 2023-09-25 13:59:18 +02:00
parent 76a4165d8a
commit fc182750ca
5 changed files with 185 additions and 2 deletions

79
last_stats.php Normal file
View file

@ -0,0 +1,79 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DTCH - PUBG Clan - Match Stats</title>
<link rel="stylesheet" href="./includes/styles.css">
</head>
<body>
<?php include './includes/navigation.php'; ?>
<main>
<section>
<h2>Player Stats</h2>
<?php
include './config/config.php';
$players_matches = json_decode(file_get_contents('./data/player_last_stats.json'), true);
echo "<table border='1'>";
echo "<tr>
<th>Playername</th>
<th>Deaths</th>
<th>Kills</th>
<th>Human Kills</th>
<th>Matches</th>
<th>K/D (Human)</th>
<th>K/D (All)</th>
</tr>";
foreach ($players_matches as $player_data) {
if (isset($player_data['updated'])) {
continue; // Skip this iteration and move to the next
}
$player_name = $player_data['playername'];
$deaths = number_format($player_data['deaths'], 2, ',', '');
$kills = number_format($player_data['kills'], 2, ',', '');
$humankills = number_format($player_data['humankills'], 2, ',', '');
$matches = $player_data['matches'];
$KD_H = ($player_data['KD_H'] == "Infinity") ? "" : number_format($player_data['KD_H'], 2, ',', '');
$KD_ALL = ($player_data['KD_ALL'] == "Infinity") ? "" : number_format($player_data['KD_ALL'], 2, ',', '');
echo "<tr>
<td>$player_name</td>
<td>$deaths</td>
<td>$kills</td>
<td>$humankills</td>
<td>$matches</td>
<td>$KD_H</td>
<td>$KD_ALL</td>
</tr>";
}
echo "</table>";
echo "Last update: ";
foreach ($players_matches as $player_data) {
if (isset($player_data['updated'])) {
echo $player_data['updated'];
break; // Once found, exit the loop
}
}
?>
</section>
</main>
<?php include './includes/footer.php'; ?>
</body>
</html>