Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("db_connect.php");
- $steamIds = [];
- $usersData = [];
- $query = "SELECT * FROM users_profiles ORDER BY `id` DESC limit 15";
- $result = mysqli_query($query) or die("Request failed");
- while ($row = mysqli_fetch_assoc($result)) {
- $usersData[$row['steam_id']] = $row;
- $steamIds = $row['steam_id']
- }
- $url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=" . $steamauth['apikey'] . "&steamids=" , join(',', $steamIds);
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_URL,$uuser);
- $result=curl_exec($ch);
- curl_close($ch);
- $steamData = json_decode($result, true);
- foreach($steamData['response']['players'] as &$player) {
- $usersData[$player['steamid']]['steam_avatar'] = $player['avatarfull'];
- $usersData[$player['steamid']]['steam_name'] = $player['personaname'];
- }
- $chunked = array_chunk($usersData, 3);
- ?>
- <table class="table table-striped table-responsive table-bordered">
- <tbody>
- <?php foreach($chunked as &$chunked_row): ?>
- <tr>
- <?php foreach($chunked_row as &$chunked_cell): ?>
- <td>
- <center>
- <img src="<?= htmlspecialchars($chunked_cell['steam_avatar']); ?>" width="50px" height="50px"/>
- <?= htmlspecialchars($chunked_cell['steam_avatar']); ?>
- </center>
- </td>
- <?php endforeach; ?>
- </tr>
- <?php endforeach; ?>
- <tbody>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement