> I am now having trouble with the condition of if the correctLogin
> variable is false or undefined or if the form.userName is undefined. I
> get either a loop (when I dont have the <cfabort> in there) or a timeout
> (when I take those out.

Based on what you pasted in, I re-worked the login code a little bit. Cut
and paste this code into your editor, and you'll see the inline comments:

<!-- Login for admin area -->
<CFAPPLICATION NAME="APOOOAdmin"
               CLIENTMANAGEMENT="Yes"
               SESSIONMANAGEMENT="Yes"
               SETCLIENTCOOKIES="Yes"
               SESSIONTIMEOUT="#CreateTimeSpan(0,1,0,0)#"
               APPLICATIONTIMEOUT="#CreateTimeSpan(1,0,0,0)#"
               CLIENTSTORAGE="COOKIE">

<!---
Next check to see if the login form has been submitted,
if yes then try to authenticate the user.
--->
<cfparam name="Session.correctLogin" type="boolean" default="FALSE">

<CFIF IsDefined("form.username")>
  <cfquery name="getUsers" datasource="apooo">
   SELECT UserID,
    UserPassword
   FROM USERS
   WHERE UserID = <cfqueryparam value="#form.UserName#"
cfsqltype="CF_SQL_VARCHAR">
  </cfquery>

  <!--- Check to see if a user was found with this user name --->
  <cfif getUsers.RecordCount EQ 1>
    <cfif getUsers.UserPassword EQ form.Password>
  <!--- Passwords match, set a logged in flag --->
  <cfset Session.CorrectLogin = TRUE>
 <cfelse>
  <!--- Passwords don't match, don't let them in --->
  <cfset Session.CorrectLogin = FALSE>
     Sorry, your username or password does not match.<br>
     <a href="mailto:[EMAIL PROTECTED]">Get help</a>
 </cfif>
  <cfelse>
    <!--- No user found with this user name, don't let them in --->
     <cfset Session.CorrectLogin = FALSE>
     Sorry, your username or password does not match.<br>
     <a href="mailto:[EMAIL PROTECTED]">Get help</a>
  </cfif>
</CFIF>

<!--- If the user was authenticated, bring to the main page, otherwise go
back to the login page --->
<cfif Session.CorrectLogin IS TRUE>
 <cflocation url="index.cfm" addtoken="No">
<cfelse>
 <cflocation url="login.cfm" addtoken="No">
</cfif>

Hope this helps,
Dave.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to