[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1562
  • Last Modified:

logout in coldfusion

In coldfusion, how do I make sure it logs out when a user just closes the browser?

Login.cfm:
<form method="post" action="Validate.cfm">
<Table cellspacing="2" cellpadding="2" align="center">
      <TR>
            <TD>
                  Email Address
            </TD>
            <TD>
                  <input name="Email">
            </TD>
      </TR>
      <TR>
            <TD>
                  Password
            </TD>
            <TD>
                  <input name="Password" type="Password">
            </TD>
      </TR>
      <TR>
            <TD colspan="2" align="center">
                  <input type="Submit" value="Submit">
            </TD>
      </TR>
      <TR>
            <TD colspan="2" align="center">
            <a href="AccountInfo.cfm">Create an account</a>
            </TD>
      </TR>
</TABLE></form>

Validate.cfm:
<cfquery name="Check_Login" datasource="MBG">
      SELECT tblClient.ClientID FROM tblClient
      Where tblClient.Email = '#Form.Email#' AND tblClient.Password = '#Form.Password#'
</cfquery>

<cfif Check_Login.recordcount>
      <cfset session.valid_account=Check_Login.ClientID>
      <cflocation url="Mainpage.cfm">
      <cfelse>
      <cflocation url="Login.cfm">
</cfif>

Mainpage.cfm and other:
<cfif not isDefined('session.valid_account')>
      <cflocation url="Login.cfm">
</cfif>

Logout.cfm:
<cfset structclear(session)>
<cflocation url="Login.cfm">

When I just close the brower and then open it again. I am able to pull data from the mainpage.cfm.
0
Karla77
Asked:
Karla77
  • 3
1 Solution
 
James RodgersWeb Applications DeveloperCommented:
try adding this to your Application.cfm
0
 
James RodgersWeb Applications DeveloperCommented:
sorry...code didn't past...doh
<cfcookie name="cfid" value="#session.cfid#">
<cfcookie name="cftoken" value="#session.cftoken#">
0
 
James RodgersWeb Applications DeveloperCommented:
glad i could help


thanks for the points
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now