Ask a Question related to Macromedia ColdFusion, Design and Development.
-
n | d | a #1
Login error with CFIF statement
Hi all: I'm having trouble with a login CFIF routine. The following code
works fine when the login is TRUE, but when I try to login with invalid info
the CFELSE statement doesn't kick in and I end up with a blank action page
screen, rather than being redirected back to the login screen. I can't figure
out why the CFELSE is not kicking in...
....<CFELSEIF action EQ "login">
<CFQUERY NAME="qry_Login" DATASOURCE="#Database.DSN#">
SELECT Username, Password
FROM tblUsers
WHERE Username = '#Form.Username#' AND Password = '#Form.Password#'
</CFQUERY>
<CFOUTPUT QUERY="qry_Login">
<CFIF qry_Login.Recordcount EQ 1>
<CFSET Client.LoggedIn = "True">
<CFSET Client.UserName = '#Username#'>
<CFLOCATION URL="index.cfm?action=viewposts" ADDTOKEN="No">
<CFELSE>
<CFLOCATION URL="index.cfm?action=login" ADDTOKEN="No">
</CFIF>
</CFOUTPUT>
<CFELSEIF>....
n | d | a Guest
-
Repeating output with cfif statement
I have a problem when multiple checkboxes are "turned on' when multiple values exist for a field in a database. For example: The following code... -
Help with cfif statement
Can anyone help me find the correct way to write the following statement? <cfif form.user2 NEQ 15 or 50 or 51 or 52 or 53 or 55 or 200 or 223 or... -
CFIF Statement problems
I am trying to write a cfif statement, which shows a form only if the statemnt acts true. It is a 3 part statement, the first two parts appear to... -
Using cfoutput within a cfif statement
I am trying to setup a form validation, what i need to do is look at the Specimen Number entered and compare it against the database to see if it... -
LOGIN: ERROR- Failed to initialize policy manager. (IFOR_PM_FATAL) Login sessions denied.
Verify that you haven't set the system date by mistake to a far away future. All the licenses then become expired! Restoring the system to the... -
-
The Dagger #3
Re: Login error with CFIF statement
Maybe try:
<cfelse>
<cfinclude template="nameofloginform.cfm">
</cfif>
The Dagger Guest
-
Kronin555 #4
Re: Login error with CFIF statement
You're doing this:
<CFOUTPUT QUERY="qry_Login">
<CFIF qry_Login.Recordcount EQ 1>
<CFSET Client.LoggedIn = "True">
<CFSET Client.UserName = '#Username#'>
<CFLOCATION URL="index.cfm?action=viewposts" ADDTOKEN="No">
<CFELSE>
<CFLOCATION URL="index.cfm?action=login" ADDTOKEN="No">
</CFIF>
</CFOUTPUT>
Note that you have a cfoutput of the query in question over the whole cfif
test. If there aren't any records returned in that query, the cfoutput won't be
processed (because the query doesn't have any records).
Change it to:
<CFIF qry_Login.Recordcount EQ 1>
<CFSET Client.LoggedIn = "True">
<CFSET Client.UserName = '#qry_Login.Username#'>
<CFLOCATION URL="index.cfm?action=viewposts" ADDTOKEN="No">
<CFELSE>
<CFLOCATION URL="index.cfm?action=login" ADDTOKEN="No">
</CFIF>
Note that the <cfoutput query="qry_Login">, </cfoutput> is completely gone.
Kronin555 Guest



Reply With Quote

