Hello,
Little background:
i needed both session timeout and check if user with the same ID is already loggen in.
So i have this code (see below) on everypage that checks for session variable and if it's expired, it would log user out and update db (set LOGGED="N"). at the same time i can look at LOGGED="Y" and determine if the user with same id ia already logged in.
It works : Another user can't login with the same id while LOGGED=Y. When Session times out and DB is updated LOGGED=N.
The problem is: when user simply closes browser. I can't find a way to update the db and set the flag to LOGGED="N"
Please help!!!
<CFIF #ParameterExists(Session.AgencyID)# is "no">
<center><b>System automatically logs out after 60 min of inactivity - Please Login again.</b></center>
<cfquery datasource="#session.dsn#" name="logoutIP">
UPDATE tblAccount
SET logged='N'
WHERE lastLoginIP='#HTTP.REMOTE_ADDR#'
</cfquery>
<CFINCLUDE TEMPLATE="index.cfm">
<CFABORT>
</CFIF>
Little background:
i needed both session timeout and check if user with the same ID is already loggen in.
So i have this code (see below) on everypage that checks for session variable and if it's expired, it would log user out and update db (set LOGGED="N"). at the same time i can look at LOGGED="Y" and determine if the user with same id ia already logged in.
It works : Another user can't login with the same id while LOGGED=Y. When Session times out and DB is updated LOGGED=N.
The problem is: when user simply closes browser. I can't find a way to update the db and set the flag to LOGGED="N"
Please help!!!
<CFIF #ParameterExists(Session.AgencyID)# is "no">
<center><b>System automatically logs out after 60 min of inactivity - Please Login again.</b></center>
<cfquery datasource="#session.dsn#" name="logoutIP">
UPDATE tblAccount
SET logged='N'
WHERE lastLoginIP='#HTTP.REMOTE_ADDR#'
</cfquery>
<CFINCLUDE TEMPLATE="index.cfm">
<CFABORT>
</CFIF>