bryanptcs Posted January 12, 2007 Share Posted January 12, 2007 Here is the code for my logout link:[code]<a href="logout.php">Logout</a>[/code]Here is logout.php:[code]<?phpheader('http://www.giftfromgodcomputerfoundation.org'); session_destroy(); ?>[/code]What i need it to do is logout the user and return them to the main page....I get the following error:Warning: session_destroy() [function.session-destroy]: Trying to destroy uninitialized session in /home/giftfrom/public_html/staff/logout.php on line 5 Quote Link to comment Share on other sites More sharing options...
taith Posted January 12, 2007 Share Posted January 12, 2007 easier way[code]<?session_start();$_SESSION=array();header('http://www.giftfromgodcomputerfoundation.org');exit;?>[/code]fyi: sessions must be started before its destroyed :-) Quote Link to comment Share on other sites More sharing options...
bryanptcs Posted January 12, 2007 Author Share Posted January 12, 2007 I also realized that it should have been...header("Location: url");instead of header('url');Thanks for you help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.