Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

logout from template

Status
Not open for further replies.

ttrinh

MIS
Joined
Jan 21, 2002
Messages
93
Location
AU
Hi
I am trying to logout of the application with a logout button but it does not work. The page consists of of 3 templates , one of which has a logout button.When the logout button is pressed, the page is just reloaded . Is there a way I can log out the user, kill the session and close the whole window?
the code for the logout button is
<input type=&quot;button&quot; value=&quot;Log Out&quot; size=&quot;26&quot; class=&quot;lhsbutton&quot; onclick=&quot;top.location.href='login.cfm?action=logout'&quot;>
and the code is the login.cfm is
<cfcase value=&quot;logout&quot;>
<!---
DeleteClientVariable(&quot;client.userid&quot;)
DeleteClientVariable(&quot;client.userkey&quot;)
DeleteClientVariable(&quot;client.password&quot;)
DeleteClientVariable(&quot;client.permission&quot;)
--->
<cfset client.userid = &quot;&quot;>
<cfset client.userkey = &quot;0&quot;>
<cfset client.password = &quot;&quot;>
<cfset client.permission = application.accessreadonly>

<cflocation url=&quot;#application.baseurl##application.basepath#index.cfm&quot; addtoken=&quot;no&quot;>
</cfcase>
In the application tag clientmanagement and sessionmanagement is enabled. But in the server administrator page the Default Client Variable Storage is cookies. I'm sorry I didn't write this original code so not everything is clear to me and I don't know if I'm missing any relevant details but can anyone help?
 
I might not be understanding you correctly, but try:
<CFSET StructClear(session)> Kevin
slanek@ssd.fsi.com

&quot;Life is what happens to you while you're busy making other plans.&quot;
- John Lennon
 
StructClear, as KevinFSI suggests, will kill the session thoroughly - it clears the session identifiers from CF's memory.

To close the window youd' need to use Javscript window.close(). But 12% of users run with Javascript off, and the rest will usually find that their browsers ask their permission to close the window. If this is the only browser window, I'm not sure if it will close on a Javascript instruction anyway.

It's more reliable to display a &quot;goodbye&quot; page, e.g. &quot;You have logged out. Thanks for visiting us. We hope to see you again soon.&quot;
 
I tried
<cfset StructClear(client)> and
the javascript window.close() statements but they both didn't work, the page just reloaded with all templates still on it.
Is there another alternative other than displaying a goodbye page ? I mean its just one click away to close the browser completely using top right hand icon so I'm not keen to add another button for users to click.
Or am I not understanding what a goodbye page is? can it be set to display for few seconds then automatically close? Is that what u mean by a goodbye page ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top