Two ways...
Open up the new CFMX7 documentation and look at Application.cfc chapter, you
will see all you need to do that kind of thing.
Otherwise, in the good old time I had to build an application level array of
structures containing my users data (id, name, lastactivitytime). I
established my timeout to be, say, 15 minutes. On each request from a user I
update his lastactivitytime... then I look at all the users in this array to
delete each entry with a lastactivitytime greater than 15 min from now. This
is a patch...
Another more precise method... you could also put an "hidden" iframe of 1px
(0px or style hidden won't work in NS, so 1 px is good) on each page and put a
meta refresh of, say, 30 seconds... so that each 30 seconds the page in the
iframe, sessiontracker.cfm would refresh this user activityTime in Application
scope. For even more fun you could have this cfm page return the list of users
logged in and use it to refresh the innerHTML of your DIV showing that list (in
the main page, not the iframe page)... dynamically. Easy enough in JS.
So, you have 3 ways of doing it. Application.cfc is the more precise... the
last one is the coolest.
ScottyMTL - 29 Oct 2005 23:33 GMT
Forgot... you can also run a scheduled task each so many minutes to check "expired" sessions instead of just counting on each user request. But the best way remains using Application.cfc