I made this session based login script setting $_SESSION['username'] to verify user agaist... now I want to create my logout logic and figured if I destroy my session the variable will dissapear but... I can't destroy my session
I have a script with only this code:
<?
session_destroy();
?>
and get the error:
"Warning: Trying to destroy uninitialized session in logout.php on line 2"
What does this mean? Or is this not the proper way to logout
thank you/
Lars Netzel
Can't destroy Session!
Moderator: General Moderators
- Heavy
- Forum Contributor
- Posts: 478
- Joined: Sun Sep 22, 2002 7:36 am
- Location: Viksjöfors, Hälsingland, Sweden
- Contact:
Try this:
Also you might want to enable session.auto_start = 1 in your php.ini
Code: Select all
unset($_SESSION);This worked!
This might have been overkill but it worked
Session_start();
Session_unset();
session_destry();
/Thank you!
Session_start();
Session_unset();
session_destry();
/Thank you!