mirror of
https://github.com/simon987/Much-Assembly-Required-Frontend.git
synced 2025-04-10 14:26:44 +00:00
24 lines
568 B
PHP
24 lines
568 B
PHP
<?php
|
|
|
|
|
|
include_once "include/UserManager.php";
|
|
include_once "include/MessageCookie.php";
|
|
include_once "include/SessionManager.php";
|
|
|
|
$username = filter_var($_POST['username'], FILTER_SANITIZE_STRING);
|
|
$password = filter_var($_POST['password'], FILTER_SANITIZE_STRING);
|
|
|
|
|
|
$user = UserManager::auth($username, $password);
|
|
|
|
if ($user != NULL) {
|
|
|
|
SessionManager::generate($user);
|
|
header("Location: index.php"); //todo user page
|
|
|
|
} else {
|
|
|
|
(new MessageCookie("Username or password incorrect", "login"))->setCookie();
|
|
header("Location: login.php#login");
|
|
|
|
} |