Re: executing a script on browser exit?

From: Date: Thu, 31 Aug 2000 20:25:55 +0000
Subject: Re: executing a script on browser exit?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-14677@lists.php.net to get a copy of this message
No offence, but solution a & b will not solve the problem. a) Even if you use a database to track the number of pages visited you'll still have no way of knowing when the user has left the site or closed her browser. You'd have to use some sort of a timeout (like sessions already do) to assume that a user that has been inactive for XXX seconds has left the site. This could easily be implemented in a custom garbage_collector function with session_set_save_handler(), but it's still not a solution to Craig's original problem. b) register_shutdown_function will not work. It is used to run a function on /script/ shutdown - not /browser/ shutdown (since that's impossible). - Jesper Juhl juhl@eisenstein.dk >>>>>>>>>>>>>>>>>> Oprindelig meddelelse >>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<< Den 8/31/00, 10:11:12 PM, skrev kbeckford@bigorbit.com ("Kevin Beckford") til emnet Re: [PHP] executing a script on browser exit?: > a) Use a database > b) look up register_shutdown_function > ----- Original Message ----- > From: Craig Simons <csimons@cdwebstudios.com> > To: <php-general@lists.php.net> > Sent: Thursday, August 31, 2000 3:58 PM > Subject: [PHP] executing a script on browser exit? > > Hello all! I've only recently picked up PHP, but I'm starting to gett the > > hang of it. My question is this: is there any way to execute a script when > > the user leaves the site or closes the window? My current design sets a > > cookie that tracks the number of pages per session that a user views.. When > > the user exits the site, I would like to write that number to a file.. I'm > > sure I could do the same thing by reading/writing to file every page, but > > that seems like quite the waste of system resources. Does anyone have any > > ideas or design alternatives? > > > > - Craig Simons > > > > > > -- > > 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 > > > -- > 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 (#14677) next »