RE: [PHP] php-javascript-html

From: Date: Wed, 06 Dec 2000 20:01:20 +0000
Subject: RE: [PHP] php-javascript-html
Groups: php.general 
Request: Send a blank email to php-general+get-28968@lists.php.net to get a copy of this message
If you want to get really fancy, you could have an image on the screen that's generated by PHP. Using onUnLoad, you can trigger this image to load with a query command that tells the PHP script to destroys the session. This lets you avoid a pop-up "goodbye" page. function session_destory ( ) { document.image[33].src = '/session_track.php?action=destroy' ; } The problem with onUnLoad in general is that it has to set a boolean value when the user clicks on the page. This prevents the session from being destroyed prematurely. Anthony -----Original Message----- From: Mark Maggelet [mailto:maggelet@mminternet.com] Sent: Wednesday, December 06, 2000 10:23 AM To: david.bravo@gemmc.ge.com; php-general@lists.php.net Subject: Re: [PHP] php-javascript-html On Wed, 6 Dec 2000 12:32:57 -0500, Bravo, David (CORP, MTC) (david.bravo@gemmc.ge.com) wrote: >How do I destroy a session <?php session_destroy() ?> when I leave a >page??? >I know I may use javascript... >Regards. > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >For additional commands, e-mail: php-general-help@lists.php.net >To contact the list administrators, e-mail: php-list- >admin@lists.php.net if the session is in a cookie and you know the name of the cookie you can do something like this: <script language="javascript"> function session_destroy(){ document.cookie="<?echo $cookiename?>=0; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/; domain=.mydomain.com"; } </script> <body onUnload="session_destroy()"> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#28968) next »