Add inactive bans, configurable limits, update configuration.

This commit is contained in:
Ruan 2015-03-07 12:31:07 +02:00
parent f933641a8d
commit d8bdfcec46
6 changed files with 71 additions and 56 deletions

View File

@ -7,7 +7,9 @@
// <<-----------------mysql Database Connection------------>> //
require 'includes/data/database.php';
$sql = 'SELECT time,until,reason,name,banned_by_name FROM ' . $table_bans . ' INNER JOIN ' . $table_history . ' on ' . $table_bans . '.uuid=' . $table_history . '.uuid WHERE active=1 GROUP BY name ORDER BY time DESC LIMIT 20';
$table = $table_bans;
$sql = 'SELECT * FROM ' . $table . ' INNER JOIN ' . $table_history . ' on ' . $table . '.uuid=' . $table_history . '.uuid ' . $active_query .
' GROUP BY name ORDER BY time DESC LIMIT ' . $limit_per_page;
if (!$result = $conn->query($sql)) {
die('Query error [' . $conn->error . ']');
@ -63,17 +65,25 @@ if(!$result = $conn->query($sql)) {
$expiresResult = date('F j, Y, g:i a', $expiresConvert);
?>
<tr>
<td><?php $banned = $row['name'];
echo "<img src='https://minotar.net/avatar/" . $banned . "/25' style='margin-bottom:5px;margin-right:5px;border-radius:2px;' />" . $banned; ?></td>
echo "<img src='https://minotar.net/avatar/" . $banned . "/25' style='margin-bottom:5px;margin-right:5px;border-radius:2px;' />" . $banned; ?>
</td>
<td><?php $banner = get_banner_name($row['banned_by_name']);
echo "<img src='https://minotar.net/avatar/" . $banner . "/25' style='margin-bottom:5px;margin-right:5px;border-radius:2px;' />" . $banner ?></td>
echo "<img src='https://minotar.net/avatar/" . $banner . "/25' style='margin-bottom:5px;margin-right:5px;border-radius:2px;' />" . $banner ?>
</td>
<td style="width: 30%;"><?php echo $row['reason']; ?></td>
<td><?php echo $timeResult; ?></td>
<td><?php if ($row['until'] <= 0) {
echo 'Permanent Ban';
} else {
<td>
<?php if ($row['until'] <= 0) {
$expiresResult = 'Permanent Ban';
}
if ($row['active'] == 0) {
$expiresResult .= ' (Unbanned)';
}
echo $expiresResult;
} ?></td>
?>
</td>
</tr>
<?php }
$result->free();

View File

@ -9,16 +9,31 @@ $password = 'password';
// Database name
$database = 'litebans';
// Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Inactive).
$show_inactive_bans = true;
// Amount of bans/mutes/warnings to show on each page
$limit_per_page = 20;
// If you set a table prefix in config.yml, put it here too
$table_prefix = "";
/*****************************************************************************/
$conn = new mysqli($dbhost, $username, $password, $database);
$table_prefix = "";
$table_bans = $table_prefix . "bans";
$table_mutes = $table_prefix . "mutes";
$table_warnings = $table_prefix . "warnings";
$table_history = $table_prefix . "history";
if ($conn->connect_errno > 0) {
die('Unable to connect to database [' . $conn->connect_error . ']');
die('Unable to connect to database: ' . $conn->connect_error);
}
$active_query = "WHERE active=1";
if ($show_inactive_bans) {
$active_query = "";
}
?>

View File

@ -21,29 +21,5 @@ $data = json_decode(file_get_contents('https://mcapi.ca/v2/query/info/?ip=' . $s
</div>
</div>
</div>
<div class="modal" id="about" tabindex="-1" role="dialog" aria-labelledby="aboutlabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="aboutlabel">About Script</h4>
</div>
<div class="modal-body">
<div class="well well-sm">
<h4>Credits</h4>
<a href="http://www.spigotmc.org/resources/litebans.3715/" target="_blank">Ruan - LiteBans
Developer</a>
<br>
<a href="http://twitter.com/ItsYive" target="_blank">Yive - Original web interface design</a>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div><!-- /.modal -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="includes/js/bootstrap.min.js"></script>

View File

@ -5,7 +5,7 @@ include 'includes/data/settings.php';
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="TempestCraft">
<meta name="author" content="LiteBans">
<link rel="shortcut icon" href="includes/img/minecraft.ico">
<link href="includes/css/bootstrap.css" rel="stylesheet">
<link href="includes/css/navbar-fixed-top.css" rel="stylesheet">

View File

@ -7,7 +7,9 @@
// <<-----------------mysql Database Connection------------>> //
require 'includes/data/database.php';
$sql = 'SELECT time,until,reason,name,banned_by_name FROM ' . $table_mutes . ' INNER JOIN ' . $table_history . ' on ' . $table_mutes . '.uuid=' . $table_history . '.uuid WHERE active=1 GROUP BY name ORDER BY time DESC LIMIT 20';
$table = $table_mutes;
$sql = 'SELECT * FROM ' . $table . ' INNER JOIN ' . $table_history . ' on ' . $table . '.uuid=' . $table_history . '.uuid ' . $active_query .
' GROUP BY name ORDER BY time DESC LIMIT ' . $limit_per_page;
if (!$result = $conn->query($sql)) {
die('Query error [' . $conn->error . ']');
@ -57,11 +59,16 @@ if(!$result = $conn->query($sql)) {
echo "<img src='https://minotar.net/avatar/" . $banner . "/25' style='margin-bottom:5px;margin-right:5px;border-radius:2px;' />" . $banner; ?></td>
<td style="width: 30%;"><?php echo $row['reason']; ?></td>
<td><?php echo $timeResult; ?></td>
<td><?php if ($row['until'] <= 0) {
echo 'Permanent Mute';
} else {
<td>
<?php if ($row['until'] <= 0) {
$expiresResult = 'Permanent Mute';
}
if ($row['active'] == 0) {
$expiresResult .= ' (Unmuted)';
}
echo $expiresResult;
} ?></td>
?>
</td>
</tr>
<?php }
$result->free();

View File

@ -7,7 +7,9 @@
// <<-----------------mysql Database Connection------------>> //
require 'includes/data/database.php';
$sql = 'SELECT time,until,reason,name,banned_by_name FROM ' . $table_warnings . ' INNER JOIN ' . $table_history . ' on ' . $table_warnings . '.uuid=' . $table_history . '.uuid WHERE active=1 ORDER BY time DESC LIMIT 20';
$table = $table_warnings;
$sql = 'SELECT * FROM ' . $table . ' INNER JOIN ' . $table_history . ' on ' . $table . '.uuid=' . $table_history . '.uuid ' . $active_query .
' GROUP BY name ORDER BY time DESC LIMIT ' . $limit_per_page;
if(!$result = $conn->query($sql)) {
die('Query error [' . $conn->error . ']');
@ -60,11 +62,16 @@ if(!$result = $conn->query($sql)) {
<td><?php $banner = get_banner_name($row['banned_by_name']);
echo "<img src='https://minotar.net/avatar/" . $banner . "/25' style='margin-bottom:5px;margin-right:5px;border-radius:2px;' />" . $banner; ?></td>
<td style="width: 30%;"><?php echo $row['reason']; ?></td>
<td><?php if ($row['until'] <= 0) {
echo 'Permanent Warning';
} else {
<td>
<?php if ($row['until'] <= 0) {
$expiresResult = 'Permanent Warning';
}
if ($row['active'] == 0) {
$expiresResult .= ' (Inactive)';
}
echo $expiresResult;
} ?></td>
?>
</td>
</tr>
<?php }
$result->free();