I have created a login screen that checks if the password is correct.
After submitting the login form I get to process.php that has these lines:
if (password_verify($passwordPost, $passwordDB)) {
$_SESSION['loged_in'] = true;
} else {
$_SESSION['loged_in'] = false;
}
# when I do a print_r on $_SESSION['loged_in'] it results true
header('Location: ../../admin/index.php');
The index page that checks the session (../../admin/index.php)
<?php
session_start();
# when I do a print_r on $_SESSION['loged_in'] here, it results false
if ($_SESSION['loged_in'] == false) {
include(PATH_COMPONENTS.'login/index.php');
}
?>
How is this possible?
session_start();inprocess.php?<?phptagerror_reporting(E_ALL); ini_set('display_errors', 1);see if it yields anything. Plus, make suresession_start();is loaded in all your PHP files, even inlogin/index.php