Re: executing a script on browser exit?
| From: | Craig Simons | Date: | Thu, 31 Aug 2000 20:56:11 +0000 |
| Subject: | Re: executing a script on browser exit? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14686@lists.php.net to get a copy of this message | ||
At 04:48 PM 8/31/00 -0400, you wrote:
None taken :) Using a database:Right now you are using the client to save your session data. You as a programmer have no control over the client side. If you store your session datain a session table, then you have total control over it. You put code on your pages to write to the db when a page is left, perhaps incrementing a value there, among other things. Using persistent connections will reduce the drain on system resources, a drain which is negligble when compared to writing and searching text files. Include a timestamp value in the database, and for any timestamps over some interval, you can write the page counter to a separate, more permanent table, and delete that session record in the session table. I see your point Kevin, which is why I was reluctant to use any sort of client-side Javascript as it is browser dependent (and even user dependent if turned off). As I have just begun teaching myself PHP about 3 days ago, I decided to stick to flat files until I felt comfortable with the language. Although on second glance, if I was using a database, there would be no real need to try and detect a browser shutdown as the values would already be incremented. I guess I'll just have to get on my horse and start databasing - Microsoft SQL server though :(