mirror of
https://gitlab.com/ruany/litebans-php.git
synced 2025-05-23 16:32:45 +00:00
More cleanup
This commit is contained in:
parent
4fee252b31
commit
09fff14917
28
bans.php
28
bans.php
@ -1,30 +1,10 @@
|
|||||||
<?php require './includes/page.php'; ?>
|
<?php require './includes/page.php'; ?>
|
||||||
<title>Tempbans - <?php echo $name; ?></title>
|
<title>Tempbans - <?php echo $name; ?></title>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php print_page_header("Bans"); ?>
|
<?php
|
||||||
<br/>
|
print_page_header("Bans");
|
||||||
<!-- Ban check form -->
|
print_check_form("bans");
|
||||||
<form onsubmit="captureForm(event);" class="form-inline">
|
?>
|
||||||
<div class="form-group">
|
|
||||||
<input type="text" class="form-control" id="user" placeholder="Player">
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-default">Check</button>
|
|
||||||
</form>
|
|
||||||
<script type="text/javascript">
|
|
||||||
function captureForm(e) {
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: 'check.php',
|
|
||||||
data: {name: document.getElementById('user').value, table: 'bans'}
|
|
||||||
}).done(function (msg) {
|
|
||||||
document.getElementById('output').innerHTML = msg;
|
|
||||||
});
|
|
||||||
e.preventDefault();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<div id="output"></div>
|
|
||||||
<!-- End ban check form -->
|
|
||||||
<div class="row" style="margin-bottom:60px;">
|
<div class="row" style="margin-bottom:60px;">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<table class="table table-hover table-bordered table-condensed">
|
<table class="table table-hover table-bordered table-condensed">
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
if (isset($_POST['name'], $_POST['table'])) {
|
if (isset($_POST['name'], $_POST['table'])) {
|
||||||
$name = $_POST['name'];
|
$name = $_POST['name'];
|
||||||
// validate user input
|
// validate user input
|
||||||
if (strlen($name) > 16 || !preg_match("/[0-9a-zA-Z_]/", $name)) {
|
if (strlen($name) > 16 || !preg_match("/^[0-9a-zA-Z_]$/", $name)) {
|
||||||
echo('Invalid name.');
|
echo('Invalid name.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -21,7 +21,9 @@ if (isset($_POST['name'], $_POST['table'])) {
|
|||||||
echo($name . ' has not joined before.');
|
echo($name . ' has not joined before.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$stmt = $conn->prepare("SELECT * FROM " . $table_bans . " WHERE (uuid=? AND active=1) LIMIT 1");
|
$table = $table_bans;
|
||||||
|
|
||||||
|
$stmt = $conn->prepare("SELECT * FROM " . $table . " WHERE (uuid=? AND active=1) LIMIT 1");
|
||||||
if ($stmt->execute(array($uuid))) {
|
if ($stmt->execute(array($uuid))) {
|
||||||
if (!($row = $stmt->fetch())) {
|
if (!($row = $stmt->fetch())) {
|
||||||
echo($name . ' is not banned.');
|
echo($name . ' is not banned.');
|
||||||
@ -31,7 +33,7 @@ if (isset($_POST['name'], $_POST['table'])) {
|
|||||||
$reason = $row['reason'];
|
$reason = $row['reason'];
|
||||||
$time = millis_to_date($row['time']);
|
$time = millis_to_date($row['time']);
|
||||||
$until = millis_to_date($row['until']);
|
$until = millis_to_date($row['until']);
|
||||||
echo($name . ' is banned! <br>');
|
echo($name . ' is banned!<br>');
|
||||||
echo('Banned by: ' . $banner . '<br>');
|
echo('Banned by: ' . $banner . '<br>');
|
||||||
echo('Reason: ' . clean($reason) . '<br>');
|
echo('Reason: ' . clean($reason) . '<br>');
|
||||||
echo('Banned on: ' . $time . '<br>');
|
echo('Banned on: ' . $time . '<br>');
|
||||||
|
@ -97,4 +97,12 @@ function print_table_headers($headers) {
|
|||||||
echo("<tbody>");
|
echo("<tbody>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function print_check_form($table) {
|
||||||
|
// var table=document.URL.substring(document.URL.lastIndexOf("/")+1); table=table.substring(0,table.indexOf("."));
|
||||||
|
echo('<br>');
|
||||||
|
echo('<form onsubmit="captureForm(event);" class="form-inline"><div class="form-group"><input type="text" class="form-control" id="user" placeholder="Player"></div><button type="submit" class="btn btn-default">Check</button></form>');
|
||||||
|
echo('<script type="text/javascript">function captureForm(b){$.ajax({type:"POST",url:"check.php",data:{name:document.getElementById("user").value,table:"' . $table . '"}}).done(function(c){document.getElementById("output").innerHTML=c});b.preventDefault();return false};</script>');
|
||||||
|
echo('<div id="output"></div>');
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
<?php require './includes/page.php'; ?>
|
<?php require './includes/page.php'; ?>
|
||||||
<title>TempMutes - <?php echo $name; ?></title>
|
<title>TempMutes - <?php echo $name; ?></title>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php print_page_header("Mutes"); ?>
|
<?php
|
||||||
|
print_page_header("Mutes");
|
||||||
|
?>
|
||||||
<div class="row" style="margin-bottom:60px;">
|
<div class="row" style="margin-bottom:60px;">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<table class="table table-hover table-bordered table-condensed">
|
<table class="table table-hover table-bordered table-condensed">
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
<?php require './includes/page.php'; ?>
|
<?php require './includes/page.php'; ?>
|
||||||
<title>Warnings - <?php echo $name; ?></title>
|
<title>Warnings - <?php echo $name; ?></title>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php print_page_header("Warnings"); ?>
|
<?php
|
||||||
|
print_page_header("Warnings");
|
||||||
|
?>
|
||||||
<div class="row" style="margin-bottom:60px;">
|
<div class="row" style="margin-bottom:60px;">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<table class="table table-hover table-bordered table-condensed">
|
<table class="table table-hover table-bordered table-condensed">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user