mirror of
https://gitlab.com/ruany/litebans-php.git
synced 2025-05-23 16:32:45 +00:00
Validate user input
This commit is contained in:
parent
07b3a63f33
commit
0848871c67
@ -1,7 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
if (isset($_POST['name'], $_POST['table'])) {
|
if (isset($_POST['name'], $_POST['table'])) {
|
||||||
require 'includes/page.php';
|
require 'includes/page.php';
|
||||||
$name = $_POST['name']; // user input
|
$name = $_POST['name'];
|
||||||
|
// validate user input
|
||||||
|
if (strlen($name) > 16 || !preg_match("/[0-9a-zA-Z_]/", $name)) {
|
||||||
|
echo('Invalid name.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
global $table_bans, $table_history, $conn;
|
global $table_bans, $table_history, $conn;
|
||||||
$stmt = $conn->prepare("SELECT name,uuid FROM " . $table_history . " WHERE name=? ORDER BY date LIMIT 1");
|
$stmt = $conn->prepare("SELECT name,uuid FROM " . $table_history . " WHERE name=? ORDER BY date LIMIT 1");
|
||||||
if ($stmt->execute(array($name))) {
|
if ($stmt->execute(array($name))) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user