Files
nexusphp/public/user-ban-log.php

37 lines
1.1 KiB
PHP
Raw Normal View History

2021-05-13 21:31:09 +08:00
<?php
require "../include/bittorrent.php";
$query = \App\Models\UserBanLog::query();
$q = $_REQUEST['q'] ?? '';
if (!empty($q)) {
$query->where('username', 'like', "%{$q}%");
}
2022-05-25 02:15:41 +08:00
$total = (clone $query)->count();
$perPage = 50;
list($paginationTop, $paginationBottom, $limit, $offset) = pager($perPage, $total, "?");
$rows = (clone $query)->offset($offset)->take($perPage)->orderBy('id', 'desc')->get()->toArray();
2021-05-13 21:31:09 +08:00
$header = [
'id' => 'ID',
'uid' => 'UID',
'username' => 'Username',
'reason' => 'Reason',
'created_at' => 'Created at',
];
$table = build_table($header, $rows);
$q = htmlspecialchars($q);
$filterForm = <<<FORM
<div>
<h1 style="text-align: center">User ban log</h1>
<form id="filterForm" action="{$_SERVER['REQUEST_URI']}" method="get">
2021-05-14 00:31:37 +08:00
<input id="q" type="text" name="q" value="{$q}" placeholder="username">
2021-05-13 21:31:09 +08:00
<input type="submit">
<input type="reset" onclick="document.getElementById('q').value='';document.getElementById('filterForm').submit();">
</form>
</div>
FORM;
stdhead('User ban log');
begin_main_frame();
echo $filterForm . $table . $paginationBottom;
stdfoot();