Cant seem to get my query to run when the session times out.
When a person logs in I set their id to session.userid
Now when the session times out, I want to run this query
<cfquery datasource="#application.dsn#">
UPDATE Logger
SET therein = '0'
WHERE logerid = #session.userid#
</cfquery>
Here is my entire application file. Never have been to good at the application file
<cfcomponent>
<cfscript>
this.name = "afentry";
this.applicationTimeout = createTimeSpan(0,0,1,20);
this.clientmanagement= "yes";
this.loginstorage = "session" ;
this.sessionmanagement = "yes";
this.sessiontimeout = createTimeSpan(0,0,1,10);
this.setClientCookies = "yes";
this.setDomainCookies = "no";
this.scriptProtect = "all";
</cfscript>
<cffunction name="onApplicationStart" output="false">
//set your app vars for the application
<cfset application.dsn = "afentry" />
</cffunction>
<cffunction name="onSessionStart" output="false">
<cfscript>
session.started = now();
</cfscript>
</cffunction>
<cffunction name="onSessionEnd" output="false">
<cfargument name = "sessionScope" required=true/>
<cfargument name = "applicationScope" required=true/>
<cfquery datasource="#application.dsn#">
UPDATE Logger
SET therein = '0'
WHERE logerid = #session.userid#
</cfquery>
<cfset var sessionLength = TimeFormat(Now() - sessionScope.started, "H:mm:ss")>
<cflock name="AppLock" timeout="5" type="Exclusive">
<cfset arguments.applicationScope.sessions = arguments.applicationScope.sessions - 1>
</cflock>
<cflog file="#this.name#" type="Information"
text="Session #arguments.sessionScope.sessionid# ended. Length: #sessionLength# Active sessions: #arguments.applicationScope.sessions#">
</cffunction>
</cfcomponent>
When a person logs in I set their id to session.userid
Now when the session times out, I want to run this query
<cfquery datasource="#application.dsn#">
UPDATE Logger
SET therein = '0'
WHERE logerid = #session.userid#
</cfquery>
Here is my entire application file. Never have been to good at the application file
<cfcomponent>
<cfscript>
this.name = "afentry";
this.applicationTimeout = createTimeSpan(0,0,1,20);
this.clientmanagement= "yes";
this.loginstorage = "session" ;
this.sessionmanagement = "yes";
this.sessiontimeout = createTimeSpan(0,0,1,10);
this.setClientCookies = "yes";
this.setDomainCookies = "no";
this.scriptProtect = "all";
</cfscript>
<cffunction name="onApplicationStart" output="false">
//set your app vars for the application
<cfset application.dsn = "afentry" />
</cffunction>
<cffunction name="onSessionStart" output="false">
<cfscript>
session.started = now();
</cfscript>
</cffunction>
<cffunction name="onSessionEnd" output="false">
<cfargument name = "sessionScope" required=true/>
<cfargument name = "applicationScope" required=true/>
<cfquery datasource="#application.dsn#">
UPDATE Logger
SET therein = '0'
WHERE logerid = #session.userid#
</cfquery>
<cfset var sessionLength = TimeFormat(Now() - sessionScope.started, "H:mm:ss")>
<cflock name="AppLock" timeout="5" type="Exclusive">
<cfset arguments.applicationScope.sessions = arguments.applicationScope.sessions - 1>
</cflock>
<cflog file="#this.name#" type="Information"
text="Session #arguments.sessionScope.sessionid# ended. Length: #sessionLength# Active sessions: #arguments.applicationScope.sessions#">
</cffunction>
</cfcomponent>