diff --git a/last_stats.php b/last_stats.php
index 26f3666..02583ac 100644
--- a/last_stats.php
+++ b/last_stats.php
@@ -6,6 +6,7 @@ error_reporting(E_ALL);
+
@@ -14,42 +15,67 @@ error_reporting(E_ALL);
+
-
+
-
-
- Player Stats past 14 days
-
+
+ Player Stats past 14 days
+ ";
- echo "
- | Playername |
- Deaths |
- Kills |
- Human Kills |
- Matches |
- K/D (Human) |
- K/D (All) |
-
";
-
- foreach ($players_matches as $player_data) {
- if (!isset($player_data['playername']) || is_null($player_data['playername'])) {
- continue; // Skip this iteration and move to the next
+ foreach ($players_matches as $key => $player_datas) {
+ if ($key == 'updated') {
+ continue;
}
- $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 "
";
+ echo "Stats for $key";
+ echo "";
echo "
+ | Playername |
+ Deaths |
+ Kills |
+ Human Kills |
+ Matches |
+ K/D (Human) |
+ K/D (All) |
+
";
+ 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 =
+ !isset($player_data['KD_H']) || $player_data['KD_H'] === null
+ ? "null"
+ : ($player_data['KD_H'] == "Infinity"
+ ? "∞"
+ : (is_numeric($player_data['KD_H'])
+ ? number_format((float) $player_data['KD_H'], 2, ',', '')
+ : "0")); // or any other default string for non-numerical values
+
+
+ $KD_ALL =
+ !isset($player_data['KD_ALL']) || $player_data['KD_ALL'] === null
+ ? "null"
+ : ($player_data['KD_ALL'] == "Infinity"
+ ? "∞"
+ : (is_numeric($player_data['KD_ALL'])
+ ? number_format((float) $player_data['KD_ALL'], 2, ',', '')
+ : "0")); // or any other default string for non-numerical values
+
+
+
+ echo "
| $player_name |
$deaths |
$kills |
@@ -58,23 +84,28 @@ error_reporting(E_ALL);
$KD_H |
$KD_ALL |
";
+ }
+
+ echo "
";
}
- echo "";
- echo "Last update: ";
- foreach ($players_matches as $player_data) {
- if (isset($player_data['updated'])) {
- echo $player_data['updated'];
- break; // Once found, exit the loop
+
+ foreach ($players_matches as $key => $update) {
+ if ($key == 'updated'){
+ echo "Last update: $update ";
+
}
}
-
- ?>
-
-
-
+
+
+ ?>
+
+
+
+
-
+
+