16 || !preg_match("/^[0-9a-zA-Z_]$/", $name)) {
echo('Invalid name.');
return;
}
require './includes/page.php';
$name = $_POST['name'];
$stmt = $conn->prepare("SELECT name,uuid FROM " . $table_history . " WHERE name=? ORDER BY date LIMIT 1");
if ($stmt->execute(array($name))) {
if ($row = $stmt->fetch()) {
$name = $row['name'];
$uuid = $row['uuid'];
}
}
if (!isset($uuid)) {
$name = htmlspecialchars($name, ENT_QUOTES, 'UTF-8');
echo($name . ' has not joined before.');
return;
}
$table = $table_bans;
$stmt = $conn->prepare("SELECT * FROM " . $table . " WHERE (uuid=? AND active=1) LIMIT 1");
if ($stmt->execute(array($uuid))) {
if (!($row = $stmt->fetch())) {
echo($name . ' is not banned.');
return;
}
$banner = get_banner_name($row);
$reason = $row['reason'];
$time = millis_to_date($row['time']);
$until = millis_to_date($row['until']);
echo($name . ' is banned!
');
echo('Banned by: ' . $banner . '
');
echo('Reason: ' . clean($reason) . '
');
echo('Banned on: ' . $time . '
');
if ($row['until'] > 0) {
echo('Banned until: ' . $until . '
');
} else {
echo('Banned permanently.');
}
}
}
?>