Re: [PHP-DB] Automatic logoff

[email protected] (Chris)
Newsgroups php.db
Message-ID <[email protected]>
listread wrote:
> Bruno,
> 
> Thanks for the heads up on the php configuration.  I'll check that out.
> 
> We also need to write some data to a database, things like logout time.  
> That means running a script for some other php code.

There are probably a number of situations where the onUnload thing won't 
work including browser crashes, some browsers may not support it, will 
it work if you have multiple browser tabs open and close one (something 
you'll have to research) etc, so be aware that you're not going to get 
this 100% right.

If you just want the timing, I'd do it the other way.

Each time their session is checked (on page load), update the "end" 
time. In db terms:

update session set logout_time=NOW() where session_id='X';

That way you're always going to get at least an idea of how long their 
session lasts but you won't get "reading time" on the page (ie it takes 
me 2 mins to read something on the page, the logout_time will be 2 
minutes before I actually close it).

-- 
Postgresql & php tutorials
http://www.designmagick.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.