My problem is that when I log in with the correct info, the login page reloads and if I refresh the page or click login again without any info in the fields, I'm redirected to the secure folder and I'm logged in. For some reason I have to reclick or refresh the page myself. Same thing happens on logout. I have to reclick the logout button.
I have a session variable called LoggedIn. By default it's 0 and when the user is logged in it's 1.
Login_e.cfm
CODE
<cfif isDefined('form.login')>
<cfif len(form.uname) gt 0 AND len(form.pword) gt 0>
<cfif form.uname eq 'a' AND form.pword eq 'b'>
<cfset Session.LoggedIn = 1>
</cfif>
<h3>Loggin unsuccessful</h3>
<cfelse>
<h3>Username and password are required.</h3>
</cfif>
</cfif>
<cfif len(form.uname) gt 0 AND len(form.pword) gt 0>
<cfif form.uname eq 'a' AND form.pword eq 'b'>
<cfset Session.LoggedIn = 1>
</cfif>
<h3>Loggin unsuccessful</h3>
<cfelse>
<h3>Username and password are required.</h3>
</cfif>
</cfif>
Public Application.cfm
CODE
<cfapplication name="PRTRSite" sessionmanagement="yes" sessiontimeout="10" clientmanagement="no">
<cflock type="exclusive" scope="session" timeout="10">
<cfparam name="Session.LoggedIn" default="0">
</cflock>
<cfif Session.LoggedIn eq 1>
<cflocation url="secure/index_e.cfm">
</cfif>
<cflock type="exclusive" scope="session" timeout="10">
<cfparam name="Session.LoggedIn" default="0">
</cflock>
<cfif Session.LoggedIn eq 1>
<cflocation url="secure/index_e.cfm">
</cfif>
Private Application.cfm
CODE
<cfapplication name="PRTRSite" sessionmanagement="yes" sessiontimeout="10" clientmanagement="no">
<cflock type="exclusive" scope="session" timeout="10">
<cfparam name="Session.LoggedIn" default="0">
</cflock>
<cfif Session.LoggedIn eq 0>
<cflocation url="../login_e.cfm">
</cfif>
<cflock type="exclusive" scope="session" timeout="10">
<cfparam name="Session.LoggedIn" default="0">
</cflock>
<cfif Session.LoggedIn eq 0>
<cflocation url="../login_e.cfm">
</cfif>
Do I have to redirect myself? Won't Application.cfm do it automatically?
