shaikat Posted December 4, 2006 Share Posted December 4, 2006 Hi all,I am starting a session when I open a page in a browser. I want to destroy the session or unregister the variables which i register within this page when I close the the window. How could I do that.please reply.Thanks in Advance -skt Quote Link to comment https://forums.phpfreaks.com/topic/29415-php-session-and-cloasing-window/ Share on other sites More sharing options...
onlyican Posted December 4, 2006 Share Posted December 4, 2006 to destroy the session you can usesession_destroy()(that destroys all sessions)or set the Session value to null$_SESSION["mysession"] = "";and by closing the window, the session is normally killded off anyway Quote Link to comment https://forums.phpfreaks.com/topic/29415-php-session-and-cloasing-window/#findComment-134981 Share on other sites More sharing options...
chiprivers Posted December 4, 2006 Share Posted December 4, 2006 I think if you usesession_set_cookie_params(x);x is the number of seconds until the cookie that holds the session id will be destroyed. If you do not declare x, and just usesession_set_cookie_params();the cookie will be destroyed whent he browser window is closed. Quote Link to comment https://forums.phpfreaks.com/topic/29415-php-session-and-cloasing-window/#findComment-134986 Share on other sites More sharing options...
shaikat Posted December 4, 2006 Author Share Posted December 4, 2006 How I track the window is closeing to call session_destroy(); I am opening a window and right click on a link and open a child window. The session is start on chid window. After closing the child window when i open a new child window find the session is still running. How i destroy the session when i close the child window.Thanks in advance-skt Quote Link to comment https://forums.phpfreaks.com/topic/29415-php-session-and-cloasing-window/#findComment-134988 Share on other sites More sharing options...
onlyican Posted December 4, 2006 Share Posted December 4, 2006 if the window is closed, the session will be destroyed automaticlyMany people have been asking about tracking when someone closes a window, for member areas, to log people out,But as far as I know, it can not be done Quote Link to comment https://forums.phpfreaks.com/topic/29415-php-session-and-cloasing-window/#findComment-134997 Share on other sites More sharing options...
shaikat Posted December 5, 2006 Author Share Posted December 5, 2006 The session does not close automaticaly. Any other solution?-skt Quote Link to comment https://forums.phpfreaks.com/topic/29415-php-session-and-cloasing-window/#findComment-135345 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.