First git commit
This commit is contained in:
40
public_html/admin/index.php
Normal file
40
public_html/admin/index.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../lib/bootstrap.php';
|
||||
$me = require_admin();
|
||||
$d = db();
|
||||
|
||||
$ok = '';
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
require_csrf();
|
||||
if (isset($_POST['motd'])) {
|
||||
setting_set('motd', mb_substr(trim((string)$_POST['motd']), 0, 200));
|
||||
$ok = 'MOTD updated.';
|
||||
}
|
||||
}
|
||||
|
||||
$stats = [
|
||||
'Users' => (int)$d->query("SELECT COUNT(*) FROM users")->fetchColumn(),
|
||||
'Banned' => (int)$d->query("SELECT COUNT(*) FROM users WHERE is_banned=1")->fetchColumn(),
|
||||
'Forums' => (int)$d->query("SELECT COUNT(*) FROM forums")->fetchColumn(),
|
||||
'Topics' => (int)$d->query("SELECT COUNT(*) FROM topics")->fetchColumn(),
|
||||
'Posts' => (int)$d->query("SELECT COUNT(*) FROM posts")->fetchColumn(),
|
||||
'Messages' => (int)$d->query("SELECT COUNT(*) FROM messages")->fetchColumn(),
|
||||
'Matches' => (int)$d->query("SELECT COUNT(*) FROM matches")->fetchColumn(),
|
||||
];
|
||||
|
||||
page_start('Admin', ['back' => '/index.php']);
|
||||
if ($ok) p_ok($ok);
|
||||
foreach ($stats as $k => $v) p_para($k . ': ' . $v);
|
||||
p_rule();
|
||||
p_links([
|
||||
['/admin/users.php', 'Manage users'],
|
||||
['/admin/forums.php', 'Manage forums'],
|
||||
['/admin/topics.php', 'Moderate topics'],
|
||||
]);
|
||||
p_rule();
|
||||
p_para('Message of the day:');
|
||||
p_form('/admin/index.php', [
|
||||
['name' => 'motd', 'label' => 'MOTD', 'value' => setting('motd'), 'maxlength' => 200],
|
||||
], 'Save');
|
||||
p_links([['/index.php', 'Home']]);
|
||||
page_end();
|
||||
Reference in New Issue
Block a user