--- WebSite CFTalk <[EMAIL PROTECTED]> wrote:
> Hello!
>
> Is there an easy way to list all active users in an
> application?
>
> (Using application management)
>
> Thanks,
> Helge
>
not automatically, because cf has no way of knowing
what session/client/cookie var contains someone's
user_id. I don't know of any way to get a list of
currently in use cfid/cftoken values.
If you're using client variables and storing them in
the db (you should), you can scan the cglobals table
(think i got that name right) for any users with a
recent value in the "lastupdated" column.. it's a
date/time field that is refreshed every time they hit
your application. You'd need to do a join to the
cdata table to grab their user_id assuming you store
it in a client variable. I don't have access to a db
with the client variable tables in it, at the moment,
but with the field names needing correction it would
be:
SELECT d.varValue FROM cdata d,cglobals g
WHERE d.varName is 'user_id' and g.lastupdated >
#createodbcdatetime(dateadd('m',-20,now()))#
Assuming you want to give them 20 minutes to refresh
before you consider them "gone". If you don't care
about them refreshing and just want to use the client
variable timeout specified in the cf administrator
then just drop the bit in the where clause about
"lastupdated".
Other than that you're stuck making a structure in the
application scope and refreshing it from your
app_globals.cfm like maybe
structinsert(application.users,"user"&session.user_id,now())
but this seems like a lot more work :)
=====
Ken Beard
Tampa, FL
[EMAIL PROTECTED]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists