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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

logout problem

Status
Not open for further replies.

leepusa

Technical User
Jan 31, 2001
4
US
I am new to coldfusion. Can anyone tell me how to logout a user after he/she view the page? After the logout button click, how to expires the previous page they just view? I want the user unable to hits the back button on the browser to view the page they just logout. Please help. Thanks.
 
There's a difference between having the browser not display the page from cache and not allowing the page to be re-loaded from the server. If you want the page to not even be shown from the browser cache, you'll need to put a meta tag in the header that tells the browser not to cache the page. If you just need to make sure they can't reload the page, then you'll need to put some type of user authentication at the top of any protected page.

This is an example of one way you could do it.

<cfparam name=&quot;session.loggedOut&quot; default=&quot;true&quot;>
<cfif session.loggedOut is &quot;true&quot;>
<cflocation url=&quot;Login.cfm&quot;>
</cfif>
.... Rest of protected page here...

On the login page, just set session.loggedOut to &quot;false&quot; if they login correctly. When they logout, set this back to &quot;false&quot;.

Hope this helps,
GJ
 
Just use this
<cfscript>
structclear(session); //kills all session variables
</cfscript>

<cflocation=&quot;url.cfm&quot;>
 
How to logout user automatically once a user close the browser or left the site? And how to know the time a user logout without click on the logout button I have created? I need to keep track the time they login and logout. Please help me. Thank you for you help.
 
Im confused about this method that CFProgrammer mentions. When I do this, It kills the session, but It also kills the CFToken, and CFID. How do you generate the login screen if its in application.cfm? Im using Advanced security, authenitacating with an LDAP server. I don't use a file called login.cfm.

What I am trying to do is to create a logout.cfm page, that CFSETs user name to&quot;&quot;, so this will cause the login screen to come up. I have not been able to get this to work.
Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top