At 03:43 AM 5/8/01, Akhmad Makki wrote:
>how can i dispose client variables automatically
>when the user closes his browser ? please help.
>
>thanks, Makki
Here is how you do it:
1) Give the user a temporary cookie in the logon page. Don't use the
EXPIRES option, which creates a cookie that is destroyed when they close
their browser. You can also set this cookie after they logon, but your
must use the <CF_LOCATION> tag instead of <CFLOCATION> if you set the
cookie in an action page.
Let's call it cookie.online.
<CFCOOKIE name="ONLINE" value="TRUE">
2) In your application.cfm or your security fuse, check if the user has
this cookie. If they don't, it means they closed their browser, and must
logon again. But, before you send them to the logon screen, destroy all
their client variables. You must not run this code for the logon or logon
action page, otherwise you get an infinite loop.
<CFIF Not IsDefined("Cookie.Online")>
<CFLOOP LIST="#GetClientVariablesList ()#" index="curvar">
<CFSET temp=DeleteClientVariable(curvar) >
</cfloop
<CFLOCATION url="index.cfm?fuseaction=logon">
</CFIF>
================================================
Douglas M. Smith - Application Architect
TeraTech - Tools for Programmers(tm)
[EMAIL PROTECTED]
================================================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists