[PHP] Session deletion on window close?
Hi there, First off this may be more of a javascript question than PHP question but I was wondering if anyone else has attempted something similar (and it does involve the deletion of PHP sessions). Here's the scenario: I have a 'stand alone' website on our intranet which creates a PHP session upon startup. A new browser window is then opened for the duration of the site - until the user has finished and wishes to leave the system. This window cannot have a link to a standard 'logout' page, it needs to delete the PHP session when the browser window is closed (possibly by launching a temporary page which calls the necessary functions and then automatically closes via javascript). The problem I have is that this site must work in both IE and Netscape and this is what is causing me headaches :) Both browsers supposedly support an 'onunload' event and I have managed to achieve what I want in IE but Netscape refuses to lauch my 'logging out' page. Does anyone have any suggestions as to how I could achieve the following: a) Browser window closed by user clicking on [X] b) 'Logging out' page opened (which handles the PHP session deletion). I hope this is clear enough. Neil Email: [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session deletion on window close?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 22-01-02 at 11:30 * Neil Freeman said Does anyone have any suggestions as to how I could achieve the following: a) Browser window closed by user clicking on [X] No but I'm sure someone will. b) 'Logging out' page opened (which handles the PHP session deletion). When a user closes the browser (any browser) the session is ended. You don't need to manually terminate it. HTH - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TUBSHpvrrTa6L5oRAn45AJ4kltU6UKb+JCSamfgUfQ+e1CPIKACff0Xn NlVo2ttprA1xjdLz6lB3DWg= =BOV1 -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session deletion on window close?
OK I agree with you there :) But as I haven't called the session_destroy() function the session file still resides in the session.save_path directory. Over time the number of these files will obviously increase so isn't it better to implement a method which calls the session_destroy() function ??? Nick Wilson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 22-01-02 at 11:30 * Neil Freeman said Does anyone have any suggestions as to how I could achieve the following: a) Browser window closed by user clicking on [X] No but I'm sure someone will. b) 'Logging out' page opened (which handles the PHP session deletion). When a user closes the browser (any browser) the session is ended. You don't need to manually terminate it. HTH - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TUBSHpvrrTa6L5oRAn45AJ4kltU6UKb+JCSamfgUfQ+e1CPIKACff0Xn NlVo2ttprA1xjdLz6lB3DWg= =BOV1 -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] *** This message was virus checked with: SAVI 3.52 last updated 8th January 2002 *** -- Email: [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session deletion on window close?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 22-01-02 at 11:46 * Neil Freeman said OK I agree with you there :) But as I haven't called the session_destroy() function the session file still resides in the session.save_path directory. Over time the number of these files will obviously increase so isn't it better to implement a method which calls the session_destroy() function ??? I see what you mean but I think you are either a: mistaken or b: under a misaprehension. The reason I say this is that I can't believe that *something* be it PHP or the system itself won't take that in to account. Have a look at the manual or whatever and if you find the answer please let me know as it's a good point. I just think I've seen something about it somewhere :) - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TUWAHpvrrTa6L5oRAoCKAJ9/YaNP4lYEnRqXc4YABWpj/kS8OwCcCW3g dx3GdbUs4s75a8PBl4zdC3Q= =7c8g -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session deletion on window close?
OK I'll have a look around. Thanks for your time Nick. Nick Wilson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 22-01-02 at 11:46 * Neil Freeman said OK I agree with you there :) But as I haven't called the session_destroy() function the session file still resides in the session.save_path directory. Over time the number of these files will obviously increase so isn't it better to implement a method which calls the session_destroy() function ??? I see what you mean but I think you are either a: mistaken or b: under a misaprehension. The reason I say this is that I can't believe that *something* be it PHP or the system itself won't take that in to account. Have a look at the manual or whatever and if you find the answer please let me know as it's a good point. I just think I've seen something about it somewhere :) - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TUWAHpvrrTa6L5oRAoCKAJ9/YaNP4lYEnRqXc4YABWpj/kS8OwCcCW3g dx3GdbUs4s75a8PBl4zdC3Q= =7c8g -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] *** This message was virus checked with: SAVI 3.52 last updated 8th January 2002 *** -- Email: [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session deletion on window close?
Uhhh? Closing a browser window, does definetly NOT delete the session. Closing a Browser Window simply does nothing on the Server-Side, so there's no command to delete a session executed. If someone manages to grab the sessionid (or the cookie) and opens the Page again, the session is still active. Neil is completely right, if he tries to generate a new GET-Request to a special log-out page on the server that uses session_destroy(). Well, I've no experence in using the window.onclose or document.onunload events with Netscape Javascript, but something like that should be the right way, if you need to be really save that a session is destroyed. Bruno Nick Wilson [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 22-01-02 at 11:30 * Neil Freeman said Does anyone have any suggestions as to how I could achieve the following: a) Browser window closed by user clicking on [X] No but I'm sure someone will. b) 'Logging out' page opened (which handles the PHP session deletion). When a user closes the browser (any browser) the session is ended. You don't need to manually terminate it. HTH - -- Nick Wilson Tel: +45 3325 0688 Fax: +45 3325 0677 Web: www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TUBSHpvrrTa6L5oRAn45AJ4kltU6UKb+JCSamfgUfQ+e1CPIKACff0Xn NlVo2ttprA1xjdLz6lB3DWg= =BOV1 -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session deletion on window close?
Actually PHP has a garbage collector that periodically it cleans deletes all those old session files. I believe you can set the time it cleans these files up in the php.ini file. Now that you know where to look a search should be able to answer this question more fully than I can and with more guidelines on how to regulate it. I hope this helps! Rick I remember a man of some standing who once came to see me and told me that a friend of his who claimed no small spiritual achievements had offended him; Who should go and make his peace with the other? he asked. I can not answer your question, I replied, as I cannot possibly set myself as a judge between you, but one thing is certain to me; the meanest of the two of you will wait for the other to make the move. The great man said no word, but went forthwith to make his peace with his friend. - Unknown From: Neil Freeman [EMAIL PROTECTED] Date: Tue, 22 Jan 2002 11:08:23 + To: PHP-General [EMAIL PROTECTED] Subject: Re: [PHP] Session deletion on window close? OK I'll have a look around. Thanks for your time Nick. Nick Wilson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * On 22-01-02 at 11:46 * Neil Freeman said OK I agree with you there :) But as I haven't called the session_destroy() function the session file still resides in the session.save_path directory. Over time the number of these files will obviously increase so isn't it better to implement a method which calls the session_destroy() function ??? I see what you mean but I think you are either a: mistaken or b: under a misaprehension. The reason I say this is that I can't believe that *something* be it PHP or the system itself won't take that in to account. Have a look at the manual or whatever and if you find the answer please let me know as it's a good point. I just think I've seen something about it somewhere :) - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TUWAHpvrrTa6L5oRAoCKAJ9/YaNP4lYEnRqXc4YABWpj/kS8OwCcCW3g dx3GdbUs4s75a8PBl4zdC3Q= =7c8g -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] *** This message was virus checked with: SAVI 3.52 last updated 8th January 2002 *** -- Email: [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]