Re: executing a script on browser exit?

From: Date: Thu, 31 Aug 2000 23:18:56 +0000
Subject: Re: executing a script on browser exit?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-14702@lists.php.net to get a copy of this message
Use sessions and a database. For every page hit, increment a database field for their sessionid. To timeout, check a timestamp field first. Like this ( untested ): if($sessionid) $r = mysql_query("update table set increment = increment + 1 where sessionid = $sessionid"); Hans Anderson me@hansanderson.com http://www.hansanderson.com/ http://www.goofiness.com/ On Thu, 31 Aug 2000, Craig Simons wrote: > 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 > >

« previous php.general (#14702) next »