From e3ee03847718a65fa9749909fe0c06069192c1c8 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 4 Oct 2023 08:43:16 +0200 Subject: [PATCH 1/6] show last matches on front page --- index.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/index.php b/index.php index 6437b69..d3130b4 100644 --- a/index.php +++ b/index.php @@ -1,3 +1,14 @@ + + @@ -16,6 +27,44 @@
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Match DatePlayer NameGame ModeMatchTypeMapKillsDamage DealtTime SurvivedWin Place

Welcome to DTCH - PUBG Clan

Join us on our Discord:

-- 2.49.1 From 20115d3e09da0bacede39465b8922792aac7015c Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 4 Oct 2023 08:45:45 +0200 Subject: [PATCH 2/6] last 5 matches total --- index.php | 54 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/index.php b/index.php index d3130b4..89c2d1c 100644 --- a/index.php +++ b/index.php @@ -3,10 +3,22 @@ $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); +// 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, 5); ?> @@ -27,8 +39,9 @@ function getLastMatches($player) {
+

Welcome to DTCH - PUBG Clan

- +
@@ -44,28 +57,25 @@ function getLastMatches($player) { - - - - - - - - - - - - + + + + + + + + + + + +
Match Date
-

Welcome to DTCH - PUBG Clan

+

Join us on our Discord:

-- 2.49.1 From 6bb1b716512768fc60d19fd2b375eac900c7d12d Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 4 Oct 2023 08:51:32 +0200 Subject: [PATCH 3/6] last 7 and mapname --- index.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 89c2d1c..2f8c5d6 100644 --- a/index.php +++ b/index.php @@ -18,7 +18,8 @@ usort($allMatches, function($a, $b) { }); // Get the last 5 matches -$lastMatches = array_slice($allMatches, 0, 5); +$lastMatches = array_slice($allMatches, 0, 7); + ?> @@ -57,6 +58,20 @@ $lastMatches = array_slice($allMatches, 0, 5); "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) { ?> @@ -64,7 +79,7 @@ $lastMatches = array_slice($allMatches, 0, 5); - + -- 2.49.1 From 1192b554c20452c90621c56b676ddc09b47b9aed Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 4 Oct 2023 08:53:48 +0200 Subject: [PATCH 4/6] no date --- index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 2f8c5d6..a7fc661 100644 --- a/index.php +++ b/index.php @@ -45,7 +45,7 @@ $lastMatches = array_slice($allMatches, 0, 7); - + @@ -75,7 +75,7 @@ $lastMatches = array_slice($allMatches, 0, 7); foreach($lastMatches as $match) { ?> - + -- 2.49.1 From 98f57828be5df1c46a59a5d5e684bdbb8b0442d3 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 4 Oct 2023 08:54:20 +0200 Subject: [PATCH 5/6] latest matches --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index a7fc661..c847cef 100644 --- a/index.php +++ b/index.php @@ -40,7 +40,7 @@ $lastMatches = array_slice($allMatches, 0, 7);
-

Welcome to DTCH - PUBG Clan

+

Latest Matches

Match Date Player Name Game Mode MatchType
-- 2.49.1 From 1660bddc0aaee91a820bfb2f01c65ec36497be4e Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 4 Oct 2023 08:55:40 +0200 Subject: [PATCH 6/6] 8 --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index c847cef..f8506d1 100644 --- a/index.php +++ b/index.php @@ -18,7 +18,7 @@ usort($allMatches, function($a, $b) { }); // Get the last 5 matches -$lastMatches = array_slice($allMatches, 0, 7); +$lastMatches = array_slice($allMatches, 0, 8); ?> -- 2.49.1