mapleleaf Posted October 29, 2008 Share Posted October 29, 2008 I am trying to end a session for logging out. If i set $_SESSION['user'] and by default sessions are creating cookies how do i delete the cookie? I don't know the cookie name. unset($_SESSION['user']) is not enough. Thanks Quote Link to comment Share on other sites More sharing options...
popcornplya Posted October 29, 2008 Share Posted October 29, 2008 session_destroy() Quote Link to comment Share on other sites More sharing options...
mapleleaf Posted October 29, 2008 Author Share Posted October 29, 2008 i tried that but if there is a cookie it doesn't end it Quote Link to comment Share on other sites More sharing options...
revraz Posted October 29, 2008 Share Posted October 29, 2008 Let's see the code you are using. Quote Link to comment Share on other sites More sharing options...
mapleleaf Posted October 29, 2008 Author Share Posted October 29, 2008 <?php session_start(); unset($_SESSION['u']); session_destroy(); ?> having $_SESSION['u'] = 'name'; Quote Link to comment Share on other sites More sharing options...
xtopolis Posted October 29, 2008 Share Posted October 29, 2008 The default name of the cookie is: PHPSESSID I think manually deleting it is something like: <?php setcookie ("PHPSESSID", "", time() - 3600); ?> Quote Link to comment Share on other sites More sharing options...
mapleleaf Posted October 29, 2008 Author Share Posted October 29, 2008 xtopolis has it. Thanks 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.