mirror of
https://github.com/simon987/Much-Assembly-Required-Frontend.git
synced 2025-12-14 23:29:02 +00:00
Initial commit
This commit is contained in:
24
auth.re.php
Normal file
24
auth.re.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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");
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user