•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ColdFusion section within the Web Development category of DaniWeb, a massive community of 456,433 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,641 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ColdFusion advertiser: Programming Forums
Views: 6140 | Replies: 1
![]() |
•
•
Join Date: Jul 2004
Posts: 8
Reputation:
Rep Power: 0
Solved Threads: 0
I have been looking up some of this stuff in my book but I just can't seem to get it. Below is my code. If my username and password are correct I want to display the page (GetPictureFromUser.cfm) If the passwords do not match up I want to display the login screen (SignIn.cfm) The code below is on a page called (CheckLogin.cfm) which is where the signin.cfm information goes. Can anyone help me!!!!!!!!!!!!
<CFQUERY datasource="A9819_myDSN" name="login">
Select Username, Password
FROM CustTable
WHERE UserName = '#UserName#' and Password = '#Password#'
</CFQUERY>
<CFIF IsDefined("URL.GetPictureFromUser.cfm")>
<CFIF getUserName.RecordCount IS 1>
<CFSET SESSION.loggedIn="yes">
<cfset session.username="#form.UserName#">
<CFLOCATION URL="GetPictureFromUser.cfm">
<CFELSE>
<CFLOCATION URL="index.cfm?failed=yes">
<CFSET StructClear(Session)>
</CFIF>
</CFIF>
<CFIF IsDefined("URL.failed")>
<CFSET session.errMsg="Login Failed, Try Again">
<CFELSEIF IsDefined("URL.notLoggedIn")>
<CFSET session.errMsg="Session expired">
<CFELSE>
<CFSET errMsg="">
</CFIF>
<CFQUERY datasource="A9819_myDSN" name="login">
Select Username, Password
FROM CustTable
WHERE UserName = '#UserName#' and Password = '#Password#'
</CFQUERY>
<CFIF IsDefined("URL.GetPictureFromUser.cfm")>
<CFIF getUserName.RecordCount IS 1>
<CFSET SESSION.loggedIn="yes">
<cfset session.username="#form.UserName#">
<CFLOCATION URL="GetPictureFromUser.cfm">
<CFELSE>
<CFLOCATION URL="index.cfm?failed=yes">
<CFSET StructClear(Session)>
</CFIF>
</CFIF>
<CFIF IsDefined("URL.failed")>
<CFSET session.errMsg="Login Failed, Try Again">
<CFELSEIF IsDefined("URL.notLoggedIn")>
<CFSET session.errMsg="Session expired">
<CFELSE>
<CFSET errMsg="">
</CFIF>
•
•
Join Date: Jun 2004
Location: Louisiana, US
Posts: 24
Reputation:
Rep Power: 5
Solved Threads: 3
I assume you are using this line of code <CFIF getUserName.RecordCount IS 1> to check if the login user and pwd was successful, however, getUserName is not the name of the query you have for checking that. "login" is what you named that query, so it should say <CFIF login.RecordCount IS 1> instead. Try that before debugging the rest of the code.
I need to check my ColdFusion Calendar because I think Christmas is coming soon! ;)
***********
Get all the SEO news and tips at SEO Scoop
***********
Get all the SEO news and tips at SEO Scoop
![]() |
•
•
•
•
•
•
•
•
DaniWeb ColdFusion Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- html/php form for .htaccess validation (PHP)
- PHP for login authentication (PHP)
- To html converter (HTML and CSS)
- ASP.NET how can i display the logod user Status (ASP.NET)
- Inserting array into cookie (PHP)
- OS X as a Primary Domain Controller (OS X)
Other Threads in the ColdFusion Forum
- Previous Thread: IF statement
- Next Thread: CF 6.1 problems..Junior Programmer - NEED HELP!


Linear Mode