Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
  2. <html>
  3. <head>
  4. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
  5. <style>
  6. .table, th, td {
  7. border: 0px solid black;
  8. background-color: #428BCA;
  9. border-color: #000 !important;
  10. color: #FFF;
  11. border-radius: 20px;
  12. }
  13. body{
  14. background-color: #000;
  15. }
  16. .table{
  17. width: 400px;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <center>
  23. <?php
  24. $start = round(microtime(true) * 1000);
  25. $servername = "127.0.0.1";
  26. $username = "root";
  27. $password = "mysql csgo yo";
  28. $dbname = "steam";
  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. $sql_temp = "/* Drop temporary ranking table if exists */
  36. DROP TEMPORARY TABLE IF EXISTS rank_order
  37.  
  38. /* Add positive ranks */
  39. CREATE TEMPORARY TABLE rank_order
  40. SELECT rank, steamId
  41. FROM steam
  42. WHERE rank > 0
  43. ORDER BY CONVERT(rank,UNSIGNED) DESC
  44.  
  45. /* Add negative ranks */
  46. INSERT INTO rank_order
  47. SELECT rank, steamId
  48. FROM steam
  49. WHERE rank < 0
  50. ORDER BY CONVERT(rank,UNSIGNED) DESC
  51.  
  52. ";
  53.  
  54. $result = $conn->query($sql);
  55. $num_rows = mysqli_num_rows($result);
  56.  
  57. if ($num_rows > 0) {
  58. // output data of each row
  59. $count = 1;
  60. echo "<table class='table table-bordered'>";
  61. echo "<center><h4><span class='label label-danger'>Top 20</span></h4></center><br /><thead><tr><th colspan='2'><center><span class='label label-success'>Position</span></center></th><th colspan='2'><center><span class='label label-success'>Name</span></center></th><th colspan='2'><center><span class='label label-success'>Rank</span></center></th></tr></thead>";
  62. while($row = $result->fetch_assoc()) {
  63. echo "<tr><td colspan='2'><center>". $count . "</center></td><td colspan='2'><center>". htmlspecialchars($row["name"]) . "</center></td><td colspan='2'><center>" . $row["rank"] . "</center></td></tr>";
  64. echo '</td>';
  65. echo '</tr>';
  66. $count+=1;
  67. }
  68. } else {
  69. echo "0 results";
  70. }
  71. echo "</table>";
  72. $conn->close();
  73. usleep(rand(2000,5000));
  74. $end = round(microtime(true) * 1000)-$start;
  75. echo "Took " . $end . " milliseconds to build this page.";
  76. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement