This commit is contained in:
Lanta 2023-09-29 12:53:53 +02:00
parent dad9b3aa95
commit e1a209a752

View file

@ -6,6 +6,7 @@ error_reporting(E_ALL);
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
@ -14,14 +15,15 @@ error_reporting(E_ALL);
<link rel="stylesheet" href="./includes/styles.css"> <link rel="stylesheet" href="./includes/styles.css">
<script src="./lib/sorttable.js"></script> <script src="./lib/sorttable.js"></script>
</head> </head>
<body> <body>
<?php include './includes/navigation.php'; ?> <?php include './includes/navigation.php'; ?>
<main> <main>
<section> <section>
<h2>Player Stats past 14 days</h2> <h2>Player Stats past 14 days</h2>
<?php <?php
include './config/config.php'; include './config/config.php';
$players_matches = json_decode(file_get_contents('./data/player_last_stats.json'), true); $players_matches = json_decode(file_get_contents('./data/player_last_stats.json'), true);
@ -37,19 +39,22 @@ error_reporting(E_ALL);
<th>K/D (All)</th> <th>K/D (All)</th>
</tr>"; </tr>";
foreach ($players_matches as $player_data) { foreach ($players_matches as $player_datas) {
if (!isset($player_data['playername']) || is_null($player_data['playername'])) {
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> foreach ($player_datas as $player_data) {
if (!isset($player_data['playername']) || is_null($player_data['playername'])) {
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>$player_name</td>
<td>$deaths</td> <td>$deaths</td>
<td>$kills</td> <td>$kills</td>
@ -58,8 +63,12 @@ error_reporting(E_ALL);
<td>$KD_H</td> <td>$KD_H</td>
<td>$KD_ALL</td> <td>$KD_ALL</td>
</tr>"; </tr>";
}
echo "</table>";
} }
echo "</table>";
echo "Last update: "; echo "Last update: ";
foreach ($players_matches as $player_data) { foreach ($players_matches as $player_data) {
if (isset($player_data['updated'])) { if (isset($player_data['updated'])) {
@ -67,14 +76,15 @@ error_reporting(E_ALL);
break; // Once found, exit the loop break; // Once found, exit the loop
} }
} }
?>
</section>
</main>
<?php include './includes/footer.php'; ?> ?>
</section>
</main>
<?php include './includes/footer.php'; ?>
</body> </body>
</html>
</html>