Match info

"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" ); // Check if a match ID is provided in the GET request 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)) { // Read and decode the JSON file $jsonData = json_decode(file_get_contents($filename), true); $matchinfo = $jsonData['data']['attributes']; $matchdata = $jsonData['data']; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
matchTypegameModedurationmapNamecreatedAtid
" . htmlspecialchars($matchinfo['matchType']) . "" . htmlspecialchars($matchinfo['gameMode']) . "" . htmlspecialchars($matchinfo['duration']) . "" . htmlspecialchars(isset($mapNames[$matchinfo['mapName']]) ? $mapNames[$matchinfo['mapName']] : $matchinfo['mapName']) . "" . htmlspecialchars($matchinfo['createdAt']) . "" . htmlspecialchars($matchdata['id']) . "
"; $directory = 'data/killstats/'; $prefix = $matchdata['id']; $files = glob($directory . $prefix . '*'); if (count($files) == 0) { // Get current time $currentTime = new DateTime(); $minutes = intval($currentTime->format('i')); // Calculate minutes to next update $minutesToNextUpdate = 30 - ($minutes % 30); if ($minutesToNextUpdate === 30) { // If it's exactly on the hour or half-hour, set the next update to 30 minutes $minutesToNextUpdate = 0; } // Display the message if ($minutesToNextUpdate > 0) { echo "Check back in $minutesToNextUpdate minutes. Data is updated every half hour."; } else { echo "Data is updating, please check back shortly."; } } else { echo ""; echo ""; foreach ($files as $file) { $jsonData_individual_player = json_decode(file_get_contents($file), true); $individualPlayerName = $jsonData_individual_player['stats']['playername']; // Search for the player in $jsonData['included'] to find damageDealt $damageDealt = 0; foreach ($jsonData['included'] as $includedItem) { if ($includedItem['type'] == "participant") { $playerStats = $includedItem['attributes']['stats']; if ($individualPlayerName == $playerStats['name']) { $damageDealt = $playerStats['damageDealt']; $rank = $playerStats['winPlace']; $DBNOs = $playerStats['DBNOs']; break; } } } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
Player Name humankills Kills Total Damage Rank DBNOs
" . htmlspecialchars($individualPlayerName) . "" . htmlspecialchars($jsonData_individual_player['stats']['humankills']) . "" . htmlspecialchars($jsonData_individual_player['stats']['kills']) . "" . htmlspecialchars($damageDealt) . "" . htmlspecialchars($rank) . "" . htmlspecialchars($DBNOs) . "
"; } echo ""; echo ""; foreach ($jsonData['included'] as $includedItem) { if ($includedItem['type'] == "participant") { $playerStats = $includedItem['attributes']['stats']; if (substr($playerStats['playerId'], 0, 2) !== 'ai') { // Create links for each stat echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } else { // Display without link echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } } } echo "
Player Name Sort Kills Damage Dealt Time Survived Rank Revs DBNOs Headshot Kills Assists
" . htmlspecialchars($playerStats['name']) . " Human " . htmlspecialchars($playerStats['kills']) . "" . htmlspecialchars($playerStats['damageDealt']) . "" . htmlspecialchars($playerStats['timeSurvived']) . "" . htmlspecialchars($playerStats['winPlace']) . "" . htmlspecialchars($playerStats['revives']) . "" . htmlspecialchars($playerStats['DBNOs']) . "" . htmlspecialchars($playerStats['headshotKills']) . "" . htmlspecialchars($playerStats['assists']) . "
" . htmlspecialchars($playerStats['name']) . "Bot" . htmlspecialchars($playerStats['kills']) . "" . htmlspecialchars($playerStats['damageDealt']) . "" . htmlspecialchars($playerStats['timeSurvived']) . "" . htmlspecialchars($playerStats['winPlace']) . "" . htmlspecialchars($playerStats['revives']) . "" . htmlspecialchars($playerStats['longestKill']) . "" . htmlspecialchars($playerStats['DBNOs']) . "" . htmlspecialchars($playerStats['assists']) . "
"; } else { echo "JSON file not found for the given match ID."; } } else { echo "No match ID provided."; } ?>