Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <META HTTP-EQUIV="REFRESH" CONTENT="20">
  6. <title>CrayoNetwork &raquo SG Leaderboards</title>
  7. <link rel="stylesheet" type="text/css" href="bootstrap.min.css">
  8. <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  9. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
  10. <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  11. </head>
  12. <body>
  13. <?php
  14. $username = "user";
  15. $password = "pass";
  16. $host = "host";
  17.  
  18. $connector = mysql_connect($host,$username,$password)
  19. or die("Unable to connect");
  20. echo "";
  21. $selected = mysql_select_db("db", $connector)
  22. or die("Unable to connect");
  23.  
  24. //execute the SQL query and return records
  25. $result = mysql_query("SELECT * FROM Stats ");
  26.  
  27. $result = mysql_query("SELECT * FROM Stats ORDER BY KILLS DESC");
  28.  
  29.  
  30. ?>
  31. <input type="submit" class="btn btn-info" onclick="alert('Website still in development.')" value="Click me for information.">
  32. <table class="table table-striped table-hover ">
  33. <thead>
  34. <tr>
  35. <th>Ranking</th>
  36. <th>Player</th>
  37. <th>UUID</th>
  38. <th>Points</th>
  39. <th>Wins</th>
  40. <th>Kills</th>
  41. <th>Deaths</th>
  42. <th>Crystals</th>
  43. </tr>
  44. </thead>
  45. <tbody>
  46. <?php
  47. function username($uuid) {
  48. $username = file_get_contents("https://us.mc-api.net/v3/name/$uuid/json");
  49. $data = json_decode($username, true);
  50. print_r($data);
  51. return $data['name'];
  52.  
  53. $numbers=array(1,2,3,4,5,6,7,8,9,10);
  54. sort($numbers);
  55.  
  56. $arrlength=count($numbers);
  57. for($x=0;$x<$arrlength;$x++)
  58.  
  59. while( $row = mysql_fetch_assoc( $result ) ){
  60. $uuid = $row['UUID'];
  61. $kills = $row['KILLS'];
  62. $deaths = $row['DEATHS'];
  63. $wins = $row['WINS'];
  64. $points = $row['POINTS'];
  65. $crystals = $row['CRYSTALS'];
  66. echo
  67. "<tr>
  68. <td>$numbers</td>
  69. <td>
  70. <img src='http://cravatar.eu/head/$uuid/64.png'/>
  71. " . username($uuid) . "</td>
  72. <td>$uuid</td>
  73. <td>$points</td>
  74. <td>$wins</td>
  75. <td>$kills</td>
  76. <td>$deaths</td>
  77. <td>$crystals</td>
  78. </tr>\n";
  79. ?>
  80. </tbody>
  81. </table>
  82. <?php mysql_close($connector); ?>
  83. </body>
  84. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement