From 8b4d5c7607d62265fcaa7fa5e7eea9f2900bda4f Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 15:45:50 +0100 Subject: [PATCH] table per player --- matchinfo.php | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/matchinfo.php b/matchinfo.php index 7024885..02b4497 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -59,7 +59,7 @@ $lastMatches = array_slice($allMatches, 0, 8); if (isset($_GET['matchid'])) { $matchId = $_GET['matchid']; $filename = "data/matches/" . $matchId . ".json"; - + // Check if the JSON file for the given match ID exists if (file_exists($filename)) { @@ -67,20 +67,7 @@ $lastMatches = array_slice($allMatches, 0, 8); $jsonData = json_decode(file_get_contents($filename), true); $matchinfo = $jsonData['data']['attributes']; $matchdata = $jsonData['data']; - - $directory = 'data/killstats/'; - $prefix = $matchdata['id']; - $files = glob($directory . $prefix . '*'); - foreach ($files as $file) { - echo $file . "\n"; - } - foreach($files as $file){ - $jsonData_individual_player = json_decode(file_get_contents($file), true); - echo $jsonData_individual_player['stats']['humankills']; - echo $jsonData_individual_player['stats']['kills']; - - } echo ""; echo ""; @@ -94,6 +81,31 @@ $lastMatches = array_slice($allMatches, 0, 8); echo "
matchTypegameModedurationmapNamecreatedAtid
"; + + + echo ""; + echo " + + + + + "; + + $directory = 'data/killstats/'; + $prefix = $matchdata['id']; + $files = glob($directory . $prefix . '*'); + + + foreach ($files as $file) { + $jsonData_individual_player = json_decode(file_get_contents($file), true); + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + echo "
Player NameKillshumankills
" . htmlspecialchars($jsonData_individual_player['stats']['playername']) . "" . htmlspecialchars($jsonData_individual_player['stats']['humankills']) . "" . htmlspecialchars($jsonData_individual_player['stats']['kills']) . "
"; + echo ""; echo " @@ -107,7 +119,6 @@ $lastMatches = array_slice($allMatches, 0, 8); "; - foreach ($jsonData['included'] as $includedItem) { if ($includedItem['type'] == "participant") { $playerStats = $includedItem['attributes']['stats'];
Player NameHeadshot Kills Assists