First git commit
This commit is contained in:
20
public_html/login.php
Normal file
20
public_html/login.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?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();
|
||||
Reference in New Issue
Block a user