Dillon Posted December 22, 2009 Share Posted December 22, 2009 Hello, how can I delete a single session? I have numerous ones on my website when a user logs in, but I have a section where I want to delete a certain session. I tried to unset it but it dosent work... Any ideas? Thanks! -Dillon Quote Link to comment https://forums.phpfreaks.com/topic/186056-delete-single-session/ Share on other sites More sharing options...
premiso Posted December 22, 2009 Share Posted December 22, 2009 If you know the session id, you can set the id with the session_id function, once the id has been set, you can then use the session_destroy function to kill the session. And to fully kill it: In order to kill the session altogether, like to log the user out, the session id must also be unset. If a cookie is used to propagate the session id (default behavior), then the session cookie must be deleted. setcookie may be used for that. Quote Link to comment https://forums.phpfreaks.com/topic/186056-delete-single-session/#findComment-982546 Share on other sites More sharing options...
Dillon Posted December 22, 2009 Author Share Posted December 22, 2009 Ok, thanks for the quick reply! This is what I have, and it isnt working... session_start($_SESSION['job']); session_destroy($_SESSION['job']); I am getting this error Warning: Wrong parameter count for session_destroy() in /home/website/public_html/login/job/login.php on line 27 Quote Link to comment https://forums.phpfreaks.com/topic/186056-delete-single-session/#findComment-982550 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.