I have a web application and it has a registration and a login, I have two headers for one to show when the user has not logged in and another for when it is already logged. but when I try to take data from the array to put it in an input of type hidden I get an error
<?php session_start();
require_once "views/extras/header.php";
require_once "views/extras/header-log.php";
if (isset($_SESSION['usuario'])) {
header('Location: index.php');
}
$errores = '';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$email = filter_var(strtolower($_POST['email']), FILTER_SANITIZE_STRING);
$password = $_POST['password'];
$password = hash('sha512', $password);
try {
$conexion = new PDO('mysql:host=localhost;dbname=empleos', 'root', '');
} catch (PDOException $e) {
echo "Error:" . $e->getMessage();;
}
$statement = $conexion->prepare('
SELECT * FROM userslog WHERE email = :email AND password = :password'
);
$statement->execute(array(
':email' => $email,
':password' => $password
));
$resultado = $statement->fetch();
if ($resultado !== false) {
$_SESSION['usuario'] = $resultado;
header('Location: index.php');
} else {
$errores .= '<li>Datos Incorrectos</li>';
}
}
require 'views/login.php';
require_once "views/extras/footer.php";
?>
that's my login code
and this is the link of all my project