Add support for checking players without JavaScript

This commit is contained in:
ruan 2019-11-29 13:09:00 +02:00
parent 967ff7638d
commit 56ebfe0150
2 changed files with 7 additions and 3 deletions

View File

@ -35,7 +35,7 @@ class Check {
if (!isset($uuid)) { if (!isset($uuid)) {
if (filter_var($name, FILTER_VALIDATE_FLOAT)) { if (filter_var($name, FILTER_VALIDATE_FLOAT)) {
echo "<br>"; echo "<br>";
redirect("info.php?id=$name&type=$type", false); redirect("info.php?id=$name&type=$type");
return; return;
} }
$name = htmlspecialchars($name, ENT_QUOTES, 'UTF-8'); $name = htmlspecialchars($name, ENT_QUOTES, 'UTF-8');
@ -50,7 +50,7 @@ class Check {
} }
echo "<br>"; echo "<br>";
redirect($href, false); redirect($href);
/* /*
$table = $page->settings->table['bans']; $table = $page->settings->table['bans'];

View File

@ -507,7 +507,11 @@ class Page {
echo ' echo '
<div class="row litebans-check"> <div class="row litebans-check">
<div class="litebans-check litebans-check-form"> <div class="litebans-check litebans-check-form">
<form onsubmit="captureForm(event);" class="form-inline"><div class="form-group"><input type="text" class="form-control" id="user" placeholder="' . $this->t("generic.player-name") . '"></div><button type="submit" class="btn btn-primary" style="margin-left: 5px;">' . $this->t("action.check") . '</button></form> <form action="check.php" onsubmit="captureForm(event);" class="form-inline"><div class="form-group">
<input type="text" class="form-control" name="name" id="user" placeholder="' . $this->t("generic.player-name") . '"></div>
<input type="hidden" name="table" value="' . $this->name . '">
<button type="submit" class="btn btn-primary" style="margin-left: 5px;">' . $this->t("action.check") . '</button>
</form>
</div> </div>
<script type="text/javascript">function captureForm(b){var o=$(".litebans-check-output");o.removeClass("show");var x=setTimeout(function(){o.html("<br>")}, 150);$.ajax({type:"GET",url:"check.php?name="+$("#user").val()+"&table=' . $table . '"}).done(function(c){clearTimeout(x);o.html(c);o.addClass("show")});b.preventDefault();return false};</script> <script type="text/javascript">function captureForm(b){var o=$(".litebans-check-output");o.removeClass("show");var x=setTimeout(function(){o.html("<br>")}, 150);$.ajax({type:"GET",url:"check.php?name="+$("#user").val()+"&table=' . $table . '"}).done(function(c){clearTimeout(x);o.html(c);o.addClass("show")});b.preventDefault();return false};</script>
</div> </div>