I am developing a custom login form. I have an Application.cfc that holds my <cflogin> that is placed inside my onRequestStart function. (I will post the code below) I have basically 2 if statements inside my <cflogin> to determine if the user is already a user with a login or if we need to create a new user. I have it set up as a <cfif> (This first statement checks weather the login form is defined.) Next I put a <cfelseif> and had (this one check weather the Create a User Form is defined.) Ok if I separate the <cfif> statements and only try to run 1 of the statements at a given time, the code for that CFIF statements works. I can login if i have a login info in the DB and/or I can create a user if I don't have login info in the DB. But if I set it up like I described above (CFIF (checks login form) CFELSEIF (checks create user form), CFELSE (always returns to cflogin form cause something went wrong)), all the code works except for the Create the User. After filling the form fields and submitting, it sends you back to the login page and when you check the DB for a User Record, there is nothing for the New User. I don't understand why the code will work if you only run a CFIF, CFELSE structure. Any help and ideas would be greatly appreciated. <!--- Here is all the code that is inside the OnPageRequest function ---> <cffunction name="onRequestStart" returntype="void" output="false"> <cfif isdefined("URL.restart")> <cfset structDelete(session, "employment")> </cfif> <cfif NOT isDefined("SESSION.employment")> <cfset SESSION.employment = createObject("component", "live.employment.new.cfc.checkUser")> </cfif> <cfif SESSION.employment.checkForLocked() IS 0> <!--- This starts the login process ---> <cflogin> <cfif IsDefined("form.loginEmail") AND IsDefined("form.userPass")> <!--- Hash the password to check the DB record ---> <cfset var hashed = hash("#FORM.userPass#")> <!--- Query the DB for the user ---> <cfquery datasource="#application.datasource#" name="qUser"> SELECT * FROM employmentUsers WHERE email = <cfqueryparam value="#FORM.loginEmail#" cfsqltype="cf_sql_varchar"> AND bob = <cfqueryparam value="#hashed#" cfsqltype="cf_sql_varchar"> </cfquery> <!--- Check to see if there is a record for the user - If a record is found log the user in ---> <cfif qUser.RecordCount EQ 1> <cfloginuser name="#qUser.email#" password="#qUser.bob#" roles="User"> <!--- If a record IS NOT found send the user back to the login screen ---> <cfelse> <cfinclude template="loginUser.cfm"> <cfabort> </cfif> <cfelseif IsDefined("form.email") AND IsDefined("form.password2")> <!--- Set a variable to use as the users role ---> <cfset role = "user"> <!--- Query the DB and check that there is not an Email already in the DB ---> <cfquery datasource="#application.datasource#" name="qcheckEmail"> SELECT email FROM employmentUsers WHERE email = <cfqueryparam value="#FORM.email#" cfsqltype="cf_sql_varchar"> </cfquery> <!--- Check to see if there is an email record for another user - If a record is found abort all send back to login form ---> <cfif qcheckEmail.RecordCount NEQ 1 AND FORM.password1 IS FORM.password2> <cfset hashed = hash("#Form.password2#")> <cfquery datasource="#application.datasource#" name="createUser"> INSERT INTO employmentUsers (firstName, lastName, email, bob, roles) VALUES ('#FORM.firstName#','#FORM.lastName#','#FORM.email#','#hashed#','#role#') </cfquery> <cfloginuser name="#FORM.email#" password="#hashed#" roles="User"> <!--- If a record IS found send the user back to the login screen to change their email ---> <cfelse> <cfinclude template="loginUser.cfm"> <cfabort> </cfif> <!--- This brings the login page back up for every page request until the user is logged in ---> <cfelse> <cfinclude template="loginUser.cfm"> <cfabort> </cfif> </cflogin> <cfelse> <cfinclude template="unavailable.cfm"> <cfabort> </cfif> </cffunction>