Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
- <html>
- <head>
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
- <style>
- .table, th, td {
- border: 0px solid black;
- background-color: #428BCA;
- border-color: #000 !important;
- color: #FFF;
- border-radius: 20px;
- }
- body{
- background-color: #000;
- }
- .table{
- width: 400px;
- }
- </style>
- </head>
- <body>
- <center>
- <?php
- $start = round(microtime(true) * 1000);
- $servername = "127.0.0.1";
- $username = "root";
- $password = "mysql csgo yo";
- $dbname = "steam";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql_temp = "/* Drop temporary ranking table if exists */
- DROP TEMPORARY TABLE IF EXISTS rank_order
- /* Add positive ranks */
- CREATE TEMPORARY TABLE rank_order
- SELECT rank, steamId
- FROM steam
- WHERE rank > 0
- ORDER BY CONVERT(rank,UNSIGNED) DESC
- /* Add negative ranks */
- INSERT INTO rank_order
- SELECT rank, steamId
- FROM steam
- WHERE rank < 0
- ORDER BY CONVERT(rank,UNSIGNED) DESC
- ";
- $result = $conn->query($sql);
- $num_rows = mysqli_num_rows($result);
- if ($num_rows > 0) {
- // output data of each row
- $count = 1;
- echo "<table class='table table-bordered'>";
- 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>";
- while($row = $result->fetch_assoc()) {
- 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>";
- echo '</td>';
- echo '</tr>';
- $count+=1;
- }
- } else {
- echo "0 results";
- }
- echo "</table>";
- $conn->close();
- usleep(rand(2000,5000));
- $end = round(microtime(true) * 1000)-$start;
- echo "Took " . $end . " milliseconds to build this page.";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement