Skip to main content
Inspiring
November 1, 2006
Question

problems with application.cfc

  • November 1, 2006
  • 2 replies
  • 319 views
in my application.cfc i have the following code in my onSessionStart function:
<cfscript>
Session.started = now();
</cfscript>

then in my onSessionEnd i have the following:
<cfquery datasource="#application.dsn#">
UPDATE users
SET lastLogin = #CreateODBCDateTime(session.Started)#
WHERE username = '#session.auth.username#'
</cfquery>
<CFOUTPUT><br>Database Updated - Last Login #CreateODBCDateTime(session.Started)#<br></CFOUTPUT>

so the idea is that when the session begins, session.started stores the date/time. then when the session ends, the session start date/time is written out to the database as the "lastLogin" field.

problem is that i am not getting any errors and the value in the database is not being updated.

any suggestions?
    This topic has been closed for replies.

    2 replies

    November 5, 2006
    When onSessionEnd is executed the session no longer exists, but a pointer is passed to the function as an argument:

    <cffunction name="onSessionEnd" returnType="void" output="false">
    <cfargument name="sessionScope" type="struct" required="true">
    <cfargument name="appScope" type="struct" required="false">
    </cffunction>

    HTH
    bdee2Author
    Inspiring
    November 1, 2006
    any ideas?