From 11cb24f71111a583c319f08185907d794c74287c Mon Sep 17 00:00:00 2001 From: Lanta 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:

From c06b6c60917628458095db2208410286a14d80ac Mon Sep 17 00:00:00 2001 From: Lanta 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:

From 11937cb8c0b8968e96a4c532529f22c1560e42df Mon Sep 17 00:00:00 2001 From: Lanta 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); - + From 4a484901a6073fe966520e3c5d52a87fb21473d8 Mon Sep 17 00:00:00 2001 From: Lanta 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) { ?> - + From 327097df329be416eaf186f417f05b4c6ed7eea7 Mon Sep 17 00:00:00 2001 From: Lanta 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
From 63b9e490047978400c8e0e596c18e79e9f757f69 Mon Sep 17 00:00:00 2001 From: Lanta 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); ?>