EasyCFM.COM ColdFusion Forums / Coding Help! / Logout Doesn't End Session

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Logout Doesn't End Session

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

metaphiz
11-04-2011 @ 6:51 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 103
Joined: Dec 2002

Users get to the login form after clicking logout, but the session
variables aren't really cleared/the session isn't really over.

Here's the way I set the session if they've entered a correct un/pw:

<!--- Remember user's logged-in status, plus --->
  <!--- ContactID and First Name, in structure --->
  <CFSET SESSION.Auth = StructNew()>
  <CFSET SESSION.Auth.IsLoggedIn = "Yes">
  <CFSET SESSION.Auth.UserName  = FORM.UserLogin>
  <CFSET SESSION.Auth.Password  = FORM.UserPassword>

  <!--- Now that user is logged in, send them --->
  <!--- to whatever page makes sense to start --->
  <CFLOCATION URL="index.cfm?bg=2">

A URL variable (LogoutNow) activates the StructClear to delete session
variables, but users can still access the pages if they type in the URL.  
Here's the code I'm using in application.cfm to delete the session:

<cfif ParameterExists(LogoutNow)>
     <cfif ParameterExists(SESSION.Auth.IsLoggedIn)>
          <cfset StructClear(SESSION.Auth.IsLoggedIn)>
          <cfset StructClear(SESSION.Auth.UserName)>
          <cfset StructClear(SESSION.Auth.Password)>
     </cfif>
<cfelse>
     <cfapplication name="SMFKPay5" SESSIONMANAGEMENT="Yes"
sessiontimeout="#CreateTimeSpan(0,0,30,0)#">
</cfif>

What am I doing wrong?  Why doesn't the session really end?

Quasi-Suave Digital--Crucial Deviations
http://www.quasisuave.com

Lyndon
11-04-2011 @ 7:35 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 66
Joined: Jun 2004

If you change:
<cfif ParameterExists(LogoutNow)>
to:
<cfif IsDefined("url.LogoutNow")>

What happens?

Lyndon

Webmaster
12-08-2011 @ 10:03 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4533
Joined: Jan 2002

<cfset temp = clearStruct(session) />

tried that?

Pablo Varando
Senior Application Architect
EasyCFM.COM, LLC.

904.483.1457 \\ mobile
webmaster@easycfm.com \\email

\m/ (>.<) \m/
--- rock on ---

Sponsored By...
iOpenSoft, LLC is a Houston, Texas Advanced Technology Studio Specializing in Web Design, Web Development, iPhone App Development and Android App Development.