You can't really have a scheduled task directly effect a session variable, however... you can have a scheduled task notify the application variable, which in turn would notify the session variable (provided you make the session variable go "look" at the application variable correctly).
There's an application that you can look up somewhere. It lets you know "who's on" the site. I'm sure someone can point it to you, don't remember where I saw it last. It was in a CFDJ article and I know Raymond C. made a nice little flash remoting app that used that example so you could basically sit there and watch who's currently on the site and where.
Anyway... it goes something like this...
Application.cfm creates that base Application variable/struct that is going to hold information regarding the session that is currently on the site. When the session variable for the user is created, you'll want the application.cfm to register that session variable with the application variable. Just a quick little "Yo, I'm here" by putting in the CFID/CFTOKEN Pair (if you desire that) into an array/structure in the application variable (You can model this to be whatever, if you need more than the CFID/CFTOKEN Pair, go for it.. nothing stopping you).
The key is to make sure that you put this logic in the Application.cfm. You'd need to make each session user check the following: 1.) Am I in the application variable? No? Put me in there. 2.) Am I in the application var? Yes? Update the timestamp I was last here (refreshed, whatever). From there, you can add in additional things. Perhaps have a flag in the application var that states whether you should be logged in or not (3.) Should I be logged in? No! Quick, the next thing I should kick off is the logout process). The trick after doing all this is getting the application variable to clean itself up after a threshold time has elapse. Session vars might expire sooner, but application vars usually stick around a little longer (unless you kill it yourself). So, whenever someone hits the website, your application var should probably scan itself to see if it should kick anyone off the list that has met that magic threshold limit.
I realize that this is all from a 10,000 feet view, but that gives you the basis of how to structure it. As I said before, there is sample code lying around on the net somewhere. Might want to search the CFDJ site first, that's where I last saw it. If you still can't find it, let me know... I can scrape up some old code that I've done something similar.
HTH, ~Todd
At 01:51 PM 5/29/2003 -0400, you wrote:
Todd,
Sounds interesting. I must be stupid this morning... how do I access users' session variables from something like scheduled task ?
Can I do something like:
<cfloop collection="#application.Sessions#" item="i"> <cfset CFID = application.Sessions[i].CFID> <cfset CFTOKEN = application.Sessions[i].CFTOKEN> <cfset Session.objUser.getCreateTime()> <!--- additional code here ---> </cfloop>
-Nelson
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com).
