1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Accommodation_Management/controller/login.php
p1907961 240492d94f ok
2021-01-05 17:53:26 +01:00

27 lines
No EOL
746 B
PHP

<?php
if(!$_SESSION['USER']->isLoggedIn() && !isset($path[1])) {
if(isset($_POST['email'],$_POST['password'])){
$user = new User;
$userArray = $user->fetch(
array(
['email','=',$_POST['email']],
['passwordHash', '=', hash('sha256',$_POST['password'])]
)
);
if(count($userArray) === 1){
/*
* Successful login
*/
$_SESSION['USER'] = $userArray[0]; // Pass the returned User type data into Session
redirect();
}else{
/*
* Error message
*/
}
}
require_once(VIEW_PATH . $path[0] . '.php');
}else{
redirect();
}