Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.54 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. body {
  6.     font-family: arial;
  7.     background-color: #3be5de;
  8. }
  9. table, th, td {
  10.     border: 1px solid black;
  11.     border-collapse: collapse;
  12.     text-align: center;
  13. }
  14. </style>
  15. <title>SuperBlaze27 Players-Server Stats</title>
  16. <!--<link>-->
  17. </head>
  18. <body>
  19. <div style="font-family: arial; color: #23a09b;">
  20. <h1>SuperBlaze27 Minecraft Server Player Stats</h1>
  21. <h3>Player joins</h3>
  22. </div>
  23. <?php
  24. $servername = "localhost";
  25. $username = "stats";
  26. $password = "***";
  27. $dbname = "stats3";
  28.  
  29. // Create connection
  30. $conn = new mysqli($servername, $username, $password, $dbname);
  31. // Check connection
  32. if ($conn->connect_error) {
  33.     die("Connection failed: " . $conn->connect_error);
  34. }
  35.  
  36. $sql = "SELECT * FROM `stats3_joins`";
  37. $result = $conn->query($sql);
  38.  
  39. if ($result->num_rows > 0) {
  40.     // output data of each row
  41. echo "<table><tr><th>Uniqe Player ID</th><th>Username</th><th>Player Head</th><th>Times Joined</th></tr>
  42.  
  43. ";
  44.     while($row = $result->fetch_assoc()) {
  45. $uuid = $row["uuid"];
  46. $uuid = str_replace('-', '', $uuid);
  47. $json_response = file_get_contents("https://sessionserver.mojang.com/session/minecraft/profile/" . $uuid . "");
  48. $data = json_decode($json_response);
  49.         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>";
  50.     }
  51. } else {
  52.     echo "0 results";
  53. }
  54. $conn->close();
  55.         echo "</table>";
  56.  
  57.  
  58. // echo "Player name:".$data->name;
  59.  
  60. ?>
  61.  
  62. </body>
  63. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement