Don\'t have an account?Click here to register
Login
';
$stylesheet = '../assets/ibuy.css';
require '../../layout.php';
require_once '../../functions.php';
$pdo = startDB();
if (isset($_POST['submit'])) {
$user = getFirstAllMatches('users', 'email', $_POST['email']); //get the first match of an all column query
if($user) { //if the user exists
if (password_verify($_POST['password'], $user['password'])) { //if the entered and stored passwords match
$_SESSION['loggedin'] = $user['user_id'];
if ($user['admin'] === 'y') {
$_SESSION['admin'] = 'y';
}
echo''; //redirect
}
else {
echo 'Unsuccessful Login
';
}
}
else {
echo 'Unsuccessful Login
';
}
}
?>