[PHP] ending a session
Hello, I started a session at www.mydomain.com:/myscript.php I want to destroy the session at www.mydomain.com/myscript.php I seem to not be able to destroy it though. Does the different port have anything to do with it? Thx, H J.J. P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ending a session
Raphael Hamzagic wrote: Thanks, But, if the client don't accept cookies? And if the user open a new browser window with the same url, the new window will use the same opened session. If the user opens a new window, without closing the old one first, then it will use the same session. If the client don't accept cookies, you'll have to turn transparant_session on. The problem with that is, that the user will not(probably, I'm not sure about this) get a new session, because the server doesn't know that the browser window is actually closed, like Rasmus told you. One reasen the user don't accept cookies, can be the following: http://www.w3.org/P3P/ Some users/browsers/company only accept cookies from websites which have a P3P statement. Other users just don't accept cookies. You'll have to live with that, use transparant_sessions and accept the negative sides of that (if it has any). HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ending a session
Victor wrote: Why not unregistered the session variables first, destroy the session second and redirect the user with a header location to a plain html page that includes a one line JavaScript in the body tag like onload+thiswindow cloase or something like that, and a message that please closes this window for complete logout. That's what I do and it works, in mozilla the script closes the window, in i.e. it asks that the user verify if they want to close the window, if they say no, then the user sees the message that please close this window to logout and that would pretty much take care of everything as far as I know. So, you first destroy the session, and then open a popup window? Why? If you destroyed the session, the user is already logged-out. Or do you destroy the session also in a popup window? In that case you have another two usergroups which can be a pain-in-the-ass: a) users that don't have JavaScript activated b) users (like me) that have a Popup killer Maybe, with all these solutions together, we can create the perfect logout script ;-)) Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ending a session
Hi, I'm just wanna know why the session doesn't end when the user closes the browser window and how can i make it. Thanks Raphael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ending a session
Because there is absolutely no way for PHP to know that the user has closed the browser window. Nothing is sent from the browser to the server on a window close. By using session cookies (cookies without a specified expiry time) the session is effectively ended since the cookie is gone once the browser has been completely shut down (not just a window). When that user comes back to the site after starting their browser again they will get a new session. -Rasmus On Thu, 5 Sep 2002, Raphael Hamzagic wrote: Hi, I'm just wanna know why the session doesn't end when the user closes the browser window and how can i make it. Thanks Raphael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ending a session
You can end the session by using function session_destroy(). See: http://www.php.net/manual/en/function.session-destroy.php For general information on how PHP handles sessions see: http://www.php.net/manual/en/ref.session.php Hope this helps. Gurhan On Thu, 2002-09-05 at 17:17, Raphael Hamzagic wrote: Hi, I'm just wanna know why the session doesn't end when the user closes the browser window and how can i make it. Thanks Raphael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ending a session
Thanks, But, if the client don't accept cookies? And if the user open a new browser window with the same url, the new window will use the same opened session. I'm having trouble with this Thanks, Raphael Rasmus Lerdorf [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Because there is absolutely no way for PHP to know that the user has closed the browser window. Nothing is sent from the browser to the server on a window close. By using session cookies (cookies without a specified expiry time) the session is effectively ended since the cookie is gone once the browser has been completely shut down (not just a window). When that user comes back to the site after starting their browser again they will get a new session. -Rasmus On Thu, 5 Sep 2002, Raphael Hamzagic wrote: Hi, I'm just wanna know why the session doesn't end when the user closes the browser window and how can i make it. Thanks Raphael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ending a session
Of course Gurhan, I have read all the php manual. How can I send a message when the user closes the browser to destroy the session? Thanks in advance Raphael Gurhan Ozen [EMAIL PROTECTED] wrote in message 1031261344.5091.266.camel@LOCALHOST">news:1031261344.5091.266.camel@LOCALHOST... You can end the session by using function session_destroy(). See: http://www.php.net/manual/en/function.session-destroy.php For general information on how PHP handles sessions see: http://www.php.net/manual/en/ref.session.php Hope this helps. Gurhan On Thu, 2002-09-05 at 17:17, Raphael Hamzagic wrote: Hi, I'm just wanna know why the session doesn't end when the user closes the browser window and how can i make it. Thanks Raphael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ending a session
Ohhh, I see what you are looking for.. You have to play around with some javascript to do it. Have a logout.php file, and destroy session in that file ... And in the main page, have the javascript to open up a new window with logout.php page. Makes sense? I hope this helps. Gurhan On Thu, 2002-09-05 at 17:32, Raphael Hamzagic wrote: Of course Gurhan, I have read all the php manual. How can I send a message when the user closes the browser to destroy the session? Thanks in advance Raphael Gurhan Ozen [EMAIL PROTECTED] wrote in message 1031261344.5091.266.camel@LOCALHOST">news:1031261344.5091.266.camel@LOCALHOST... You can end the session by using function session_destroy(). See: http://www.php.net/manual/en/function.session-destroy.php For general information on how PHP handles sessions see: http://www.php.net/manual/en/ref.session.php Hope this helps. Gurhan On Thu, 2002-09-05 at 17:17, Raphael Hamzagic wrote: Hi, I'm just wanna know why the session doesn't end when the user closes the browser window and how can i make it. Thanks Raphael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ending a session
A little addition/clarification, I mean in the main page, have the javascript open up a new window with logout.php file when the user closes the browser. Gurhan On Thu, 2002-09-05 at 18:04, Gurhan Ozen wrote: Ohhh, I see what you are looking for.. You have to play around with some javascript to do it. Have a logout.php file, and destroy session in that file ... And in the main page, have the javascript to open up a new window with logout.php page. Makes sense? I hope this helps. Gurhan On Thu, 2002-09-05 at 17:32, Raphael Hamzagic wrote: Of course Gurhan, I have read all the php manual. How can I send a message when the user closes the browser to destroy the session? Thanks in advance Raphael Gurhan Ozen [EMAIL PROTECTED] wrote in message 1031261344.5091.266.camel@LOCALHOST">news:1031261344.5091.266.camel@LOCALHOST... You can end the session by using function session_destroy(). See: http://www.php.net/manual/en/function.session-destroy.php For general information on how PHP handles sessions see: http://www.php.net/manual/en/ref.session.php Hope this helps. Gurhan On Thu, 2002-09-05 at 17:17, Raphael Hamzagic wrote: Hi, I'm just wanna know why the session doesn't end when the user closes the browser window and how can i make it. Thanks Raphael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ending a session
Why not unregistered the session variables first, destroy the session second and redirect the user with a header location to a plain html page that includes a one line JavaScript in the body tag like onload+thiswindow cloase or something like that, and a message that please closes this window for complete logout. That's what I do and it works, in mozilla the script closes the window, in i.e. it asks that the user verify if they want to close the window, if they say no, then the user sees the message that please close this window to logout and that would pretty much take care of everything as far as I know. - Victor www.argilent.com -Original Message- From: Raphael Hamzagic [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 5:32 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] ending a session Of course Gurhan, I have read all the php manual. How can I send a message when the user closes the browser to destroy the session? Thanks in advance Raphael Gurhan Ozen [EMAIL PROTECTED] wrote in message 1031261344.5091.266.camel@LOCALHOST">news:1031261344.5091.266.camel@LOCALHOST... You can end the session by using function session_destroy(). See: http://www.php.net/manual/en/function.session-destroy.php For general information on how PHP handles sessions see: http://www.php.net/manual/en/ref.session.php Hope this helps. Gurhan On Thu, 2002-09-05 at 17:17, Raphael Hamzagic wrote: Hi, I'm just wanna know why the session doesn't end when the user closes the browser window and how can i make it. Thanks Raphael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Post your free ad now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php