Files
txt3-wap/public_html/login.php
2026-09-08 18:21:10 +01:00

21 lines
690 B
PHP

<?php
require_once __DIR__ . '/lib/bootstrap.php';
$err = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
require_csrf();
$n = trim((string)($_POST['username'] ?? ''));
$p = (string)($_POST['pass'] ?? '');
if (user_login($n, $p)) redirect('/index.php');
$err = 'Bad username or password (or account banned).';
}
page_start('Log in', ['back' => '/index.php']);
if ($err) p_err($err);
p_form('/login.php', [
['name' => 'username', 'label' => 'Username', 'maxlength' => 16],
['name' => 'pass', 'label' => 'Password', 'type' => 'password', 'maxlength' => 40],
], 'Log in');
p_links([['/signup.php', 'Create an account'], ['/index.php', 'Home']]);
page_end();