Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('display_errors', 1);
- // MoneySQL PHP script v6 (27-12-2016).
- // by Wruczek. MIT License.
- // http://dev.bukkit.org/bukkit-plugins/moneysql/
- // CONFIGURATION - EDIT THIS
- $database_adress = "localhost";
- $database_name = "moneysql";
- $database_user = "Wruczek";
- $database_password = "password";
- // Optional configuration
- $theme = 'united'; // Themes: Cerulean, Cosmo, Cyborg, Darkly, Flatly, Journal, Lumen, Paper, Readable, Sandstone, Simplex, Slate, Spacelab, Superhero, United, Yeti
- $how_many = 10;
- $title = "Top $how_many richest players on the server.";
- $page_title = $title;
- $show_uuid = true;
- $padding_top = "100px";
- // {balance} will be replaced with player balance.
- $money_format = "$ {balance}";
- // Head size in pixels.
- $head_size = 30;
- // END OF CONFIGURATION
- $con = mysqli_connect($database_adress, $database_user, $database_password, $database_name);
- if (mysqli_connect_errno()) {
- die("<h3 class='text-center'>Failed to connect to MySQL: " . mysqli_connect_error() . "</h3>");
- }
- ?>
- <html>
- <head>
- <meta charset="utf-8">
- <meta content="Wruczek" name="author">
- <title><?php echo $title; ?></title>
- <link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/<?php echo strtolower($theme) ?>/bootstrap.min.css" rel="stylesheet">
- <style>
- body {
- padding-top: <?php echo $padding_top ?>;
- }
- </style>
- </head>
- <body>
- <div class="container">
- <h2 class="text-center"><?php echo $page_title; ?></h2>
- <table class="table table-striped table-hover">
- <thead>
- <tr>
- <th>#</th>
- <th>Head</th>
- <th>Nickname</th>
- <?php if ($show_uuid) { ?>
- <th>UUID</th>
- <?php } ?>
- <th>Balance</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $num = 0;
- $result = mysqli_query($con, "SELECT * FROM `moneysql` ORDER BY `money` DESC LIMIT $how_many");
- if (!$result) {
- die("ERROR: Server not returned any data. " . mysqli_error($con));
- }
- while ($row = mysqli_fetch_array($result)) {
- $num++;
- $uuid = $row['UUID'];
- $nick = $row['last_known_name'];
- $money = $row['money'];
- $img = sprintf('<img src="https://minotar.net/helm/%s/%d.png">', $nick, $head_size);
- echo "<tr><td>$num</td><td>$img</td><td>$nick</td>";
- if ($show_uuid)
- echo "<td>$uuid</td>";
- echo "<td>" . str_replace("{balance}", $money, $money_format) . "</td></tr>";
- }
- mysqli_close($con);
- ?>
- </tbody>
- </table>
- <div class="footer">
- © <a href="https://wruczek.tech/">Wruczek</a> for <a href="http://dev.bukkit.org/bukkit-plugins/moneysql/" target="blank">MoneySQL</a> bukkit plugin.
- </div>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment