I once did something like this....(havent tested this pseudo-cfcode..
but you get the idea)


(in your app_locals or application.cfm, etc, wherever you initialize
things)


<!--- application.cfm or other intiialization templates --->
<Cfparam name="session.online" default="X">
<Cfparam name="session.loggedin" default="false">
<Cfparam name="application.online" default="#structnew()#">
<Cfif not session.loggedin and issimplevalue(session.online)>
    <Cfset session.online.stamp=now()>
</cfif>

(In page which processes successful login )
<!---- act_login.cfm or other session-now-online-page ---->
<Cflock...do your locking here>
      <cfscript>
            session.userIDorName=whateverIdentifiesThisUser;
            session.>

structinsert(application.online,session.userIDorName,session.online);

            session.online.stamp=now();
            session.online.loggedin=true;
            session.loggedin=true;
       </cfscript>
</cflock...>


(In page which logs out)
<!--- act_logout or whatever processes manual logout --->
<cflock ... do your locking here>
    <cfscript>
        session.online.loggedin=false;
        structdelete(application.online,session.userIDOrName);
        structclear(session);
    </cfscript>
</cflock>


(page for periodic cleanup -- put this in the CFScheduler every X
minutes, or create a  java thread if you want)
<!--- cleanUp.cfm --->
<cflock ...application...>
    <cfset >     <!--- use a local safe copy --->
</cflock>


<Cfloop index="u" list=structkeylist(online)>
    <cfset mystr=structfind(online,u)>
    <cfif not mystr.loggedin or abs(datediff("n",now(),mystr.stamp)) gt
THRESHOLD_MINUTES>
        <cflock ...application...>   
            <cfset structdelete(application.online,u)>
        </cflock>
            <!---(Do your cleanup/post-processing here)---->
    </cfif>
</cfloop>

  _____  

From: Ian Skinner [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 23, 2004 11:09 AM
To: CF-Talk
Subject: RE: Time Tracking

I would add that the current "anti-popup" climate has brought on a host
of new pop-up blocking tools. If in your
"onUnload" function you are calling another page, I suspect a popup
blocker would take issue with that - no?

-Mark

I would say that is a high probability as well.

Ian

Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to