0
I am making a page, and in parts, PHP use, but in one part gives an error in the log out. Follow the error:
Warning: session_destroy(): Trying to Destroy uninitialized Session on line 22.
Follows the line:
if ((!$loginrequired) or ((isset($_SESSION) or !isset($_SESSION) and session_start())
and (isset($_SESSION['lname']) and isset($_SESSION['lpass']))
and isValidLogin($_SESSION['lname'], $_SESSION['lpass']))) {
header("location:/questions/home");
} else {
unset($_SESSION['lpass']);
unset($_SESSION['lname']);
if (isset($_SESSION)) {
session_destroy();
}
}
I thought it strange the error appeared, if I made the check.
Does anyone know what it can be?
The
session_start
should be the first thing to be started on your script before any echo or output. What is it doing inside theif
?– gmsantos