artcalv Posted January 18, 2007 Share Posted January 18, 2007 Hi!I have a problem with sessions in browsers with tabs (like Internet Explorer 7.0).If I open a window of my php site, log in with an user and store it's name in a session var... and do exactly the same in another tab of the browser with a different user... then, when I change of tab, the session becomes the same in both windows!!Another problem working with sessions... is there a way to know when the user has closed the browser's window? Because I need to log-out automatically.What can I do? Please, help!!!!Thanks :) Link to comment https://forums.phpfreaks.com/topic/34780-problem-with-sessions/ Share on other sites More sharing options...
pocobueno1388 Posted January 18, 2007 Share Posted January 18, 2007 I think sessions end by default when the browser is closed unless specified otherwise.Do you have your session_start() on every page? Link to comment https://forums.phpfreaks.com/topic/34780-problem-with-sessions/#findComment-163941 Share on other sites More sharing options...
artcalv Posted January 18, 2007 Author Share Posted January 18, 2007 Thanks for your reply!Yeah, I have session_start() everywhere. I know that session is finished when browser is closed, but I NEED to know when someone closes it, because I have to change a value "connected" in my database... Something about capturing event of closing the window?Any idea about the problem with tabs!Thanks :) Link to comment https://forums.phpfreaks.com/topic/34780-problem-with-sessions/#findComment-163955 Share on other sites More sharing options...
kenrbnsn Posted January 18, 2007 Share Posted January 18, 2007 Sessions are tied to browser instances, not tabs.Ken Link to comment https://forums.phpfreaks.com/topic/34780-problem-with-sessions/#findComment-164091 Share on other sites More sharing options...
Nhoj Posted January 19, 2007 Share Posted January 19, 2007 There is no possible way to tell if a user closed his / her browser window by using PHP. Link to comment https://forums.phpfreaks.com/topic/34780-problem-with-sessions/#findComment-164107 Share on other sites More sharing options...
pocobueno1388 Posted January 19, 2007 Share Posted January 19, 2007 Thats what I was thinking...I don't know of a language that supports that if there is one. Maybe Javascript? I'm not sure. Link to comment https://forums.phpfreaks.com/topic/34780-problem-with-sessions/#findComment-164131 Share on other sites More sharing options...
artcalv Posted January 19, 2007 Author Share Posted January 19, 2007 If anyone knows it can be done in another language, please, tell me!About the other problem I have, does any one have a solution? I repeat what happens:"If I open a window of my php site, log in with an user and store it's name in a session var... and do exactly the same thing in another tab of the browser with a different user... then, when I change of tab, the session becomes the same in both windows!!"What can I do??? Thanks a lot :) Link to comment https://forums.phpfreaks.com/topic/34780-problem-with-sessions/#findComment-164180 Share on other sites More sharing options...
whitelion Posted January 19, 2007 Share Posted January 19, 2007 Yes,session will be stored your username.When you try to logging with different nick.It will become only one username.Solution : you should using cookies to save your username with any nick. Link to comment https://forums.phpfreaks.com/topic/34780-problem-with-sessions/#findComment-164184 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.