Hi all,
Can someone please explain how sessions work in PHP v4+? Here is what I have.
I have a logout page:
session_destroy();
echo "<script language='javascript'>";
echo "document.location='login.php';";
echo "</script>";
I get the error message:
Trying to destroy uninitialized session in
I have a login page: (at the very top)
session_start();
session_register("SESSION");
I initialize later with:
$row = mysql_fetch_array($sql_result);
$SESSION["var1"] = $row[0];
Later in my code I have this... I want I logout link to display so long as the session is still active.
<?PHP
if (isset($SESSION))
{ echo " | <a href='logout.php'>Logout</a>"; }
?>
It doesn't work. When I click the logout button
1 -get that error
2 -the logout link always displays.
Thanks a bunch,
David