[thelist] Session Variables in ColdFusion

Raymond Camden rcamden at allaire.com
Thu Jan 18 22:30:31 CST 2001


Hah, you wish. :> Sorry, but there isn't a way to check all sessions unless
you code around it. I can say that this is a feature many people have asked
for, so we may see it in later versions of CF.

As it stands, the hack to make it work is _very_ easy.

On logon, simply add a key to a structure in the application scope. Call it,
AllSessions. The key should be a unique identifier for the user, so just use
Session.URLToken.

For the value, use whatever you want. If you want to know all the users
online, save the username. If you want access to all the userdata, just use
Duplicate to copy it over. (But beware the Duplicate bug.)

Now, here is one problem. When the session dies, the application var will
still have a pointer. To take care of this, use onRequestEnd.cfm to save the
current time in AllSessions[Session.URLToken].LastHit. In your script that
displays all the users, check LastHIt, and if the DateDiff is more then your
session timeout, either ignore the key or delete it.

If you search the Developer's Exchange, you will find a custom tag called
SessionMagic that abstracts a lot of this for you.


=======================================================================
Raymond Camden, Principal Spectra Compliance Engineer for Allaire

Email   : jedimaster at allaire.com
ICQ UIN : 3679482

"My ally is the Force, and a powerful ally it is." - Yoda

> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of Joshua OIson
> Sent: Thursday, January 18, 2001 11:51 PM
> To: thelist at lists.evolt.org
> Subject: [thelist] Session Variables in ColdFusion
>
>
> Can anybody (Raymond) please remind me of what array it is in Cold Fusion
> that stores the id's of all active sessions?  I want to be able to check
> sessions to see if they are still active when I know the cfid and cftoken.
>
> thanks,
> -joshua
>
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list