User Stats


"; // Buttons for each player echo "
"; foreach ($clanmembers as $player) { echo ""; } echo "

"; $selected_player = $_POST['selected_player'] ?? $clanmembers[0]; // Retrieve user IDs $players_url = "https://api.pubg.com/shards/steam/players?filter[playerNames]=$selected_player"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $players_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $players_response = curl_exec($ch); curl_close($ch); $players_data = json_decode($players_response, true); if (isset($players_data['data'])) { $player = $players_data['data'][0]; $player_id = $player['id']; $player_name = $player['attributes']['name']; // Retrieve lifetime stats $lifetime_url = "https://api.pubg.com/shards/steam/players/$player_id/seasons/lifetime?filter[gamepad]=false"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $lifetime_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $lifetime_response = curl_exec($ch); curl_close($ch); $lifetime_data = json_decode($lifetime_response, true); if (isset($lifetime_data['data']['attributes']['gameModeStats'][$selected_mode])) { $stats = $lifetime_data['data']['attributes']['gameModeStats'][$selected_mode]; echo "

" . ucfirst($selected_mode) . " Lifetime Stats for $player_name

"; echo ""; echo ""; foreach ($stats as $stat_name => $stat_value) { echo ""; } echo "
Stat NameValue
$stat_name$stat_value

"; } } else { echo "No player data available."; } ?>