Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- body {
- font-family: arial;
- background-color: #3be5de;
- }
- table, th, td {
- border: 1px solid black;
- border-collapse: collapse;
- text-align: center;
- }
- </style>
- <title>SuperBlaze27 Players-Server Stats</title>
- <!--<link>-->
- </head>
- <body>
- <div style="font-family: arial; color: #23a09b;">
- <h1>SuperBlaze27 Minecraft Server Player Stats</h1>
- <h3>Player joins</h3>
- </div>
- <?php
- $servername = "localhost";
- $username = "stats";
- $password = "***";
- $dbname = "stats3";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT * FROM `stats3_joins`";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- echo "<table><tr><th>Uniqe Player ID</th><th>Username</th><th>Player Head</th><th>Times Joined</th></tr>
- ";
- while($row = $result->fetch_assoc()) {
- $uuid = $row["uuid"];
- $uuid = str_replace('-', '', $uuid);
- $json_response = file_get_contents("https://sessionserver.mojang.com/session/minecraft/profile/" . $uuid . "");
- $data = json_decode($json_response);
- print "<tr><td>#" . $row["id"]. "</td><td> ". $data->name . "</td><td><img src='https://crafatar.com/avatars/" . $uuid . "?size=32'/img></td><td>" . $row["value"]. "</td></tr>";
- }
- } else {
- echo "0 results";
- }
- $conn->close();
- echo "</table>";
- // echo "Player name:".$data->name;
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement