Here is my code for setting sessions in user-authentication.php
:
session_start();
$_SESSION['admin_name'] = $name;
$_SESSION['sbc_admin'] = "y";
$_SESSION['admin_email'] = $email;
header("Location:includes/user-auth.php");
and here's the code to check whether sessions are set or in user-auth.php
:
session_start();
if (isset($_SESSION["sbc_admin"])) {
$admin = $_SESSION["sbc_admin"];
$name = $_SESSION["admin_name"];
$email = $_SESSION["admin_email"];
} else {
header("Location:../index.php");
}
After redirection, session variables are lost. I have tried a few tricks but it's still not working.