Sure, use the new onSessionStart/onSessionEnd features of CFMX7. This
is assuming you want to track a session, and not just when a person
logs on. If you only care when they logon, you can simply increment an
application counter. On logoff, decrease it. You also need to record
when they last hit. That way if their session expires, you can remove
them from the application scope. This is only necessary in CFMX
versions less then 7.0 though.

Some more hints - one nice way to track the sessions is to use a
struct in the application scope. You have a built in primary key for
each user called Session.URLToken, so you can do something like so:

<cfset application.sessions[session.urltoken] = now()>

This would log their unique ID and the time they hit the site. You
could run this code for every request if you wanted to keep it simple.
Your code to count the sessions would simply  loop over the keys and
remove folks who have not hit the site in more minutes than your
session timeout. (Again, MUCH easier in CFMX7.) After "cleaning" the
struct, you can use structCount() to get the # of active users.

Make sense?



On Fri, 04 Mar 2005 20:18:41 +0800, Johnson <[EMAIL PROTECTED]> wrote:
> Hi everyone,
> 
> Does anyone has any ideas on tracking the total login into an application?
> - To track the total users currently login into the system
> - When they logout, the total count will decrease by 1
> 
> Thanks in advance,
> Johnson
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197429
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to