> Im storing three values during a session in a db. When the user logs off 
> or when they just close the broswer, I want those values turned back to 0.
> 
> I know how to do this if they just log out but, how would you do this if 
> they just close the broswer?
> 
> Wade


Storing session variables in a DB has certain advantages.  You may be able to
use the onunload event in the <body> tag to activate a PHP script which would
remove the session variables from the DB.  The onunload event can be
unreliable, however.  If the browser crashes it won't work for example.

If you were using PHP's default file-based sessions, when the browser is
closed, the session ID cookie goes away and the session is invalid.  The /tmp
directory should get cleaned up on a periodic basis.  If not, you could make a
cron job to do that.  It all depends on the details.

James
_____


James D. Keeline
http://www.Keeline.com  http://www.Keeline.com/articles
http://Stratemeyer.org  http://www.Keeline.com/TSCollection

http://www.ITeachPHP.com -- Free Computer Classes: Linux, PHP, etc.
Spring Semester Begins Jan 31 -- New Classes Start Every Few Weeks.


Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to