session_destroy()
Posted: Thu Feb 18, 2010 10:23 am
I have a working login - and I want a log out button.
What I've got for my button is:
And logout.php:
But its not working, it gives this: Warning: session_destroy() [function.session-destroy]: Trying to destroy uninitialized session in D:\wamp\wamp\www\stuff\logout.php on line 2
My session is started elsewhere, so what do I need to do in order to destroy my session and get my user to log out?
What I've got for my button is:
Code: Select all
<form action='logout.php' method='post'><input name='Logout' type='Submit' value='Logout' /></form>Code: Select all
<?php
session_destroy();
echo "You have logged out";
echo "<head><meta HTTP-EQUIV='REFRESH' content='10; url=index.html'></head>";
?>My session is started elsewhere, so what do I need to do in order to destroy my session and get my user to log out?