943,645 Members | Top Members by Rank

Ad:
  • ColdFusion Discussion Thread
  • Unsolved
  • Views: 7441
  • ColdFusion RSS
Jul 27th, 2004
0

Need Help with login authentication

Expand Post »
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>
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cfnut is offline Offline
8 posts
since Jul 2004
Jul 28th, 2004
0

Re: Need Help with login authentication

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.
Reputation Points: 10
Solved Threads: 3
Light Poster
dazzlindonna is offline Offline
29 posts
since Jun 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ColdFusion Forum Timeline: IF statement
Next Thread in ColdFusion Forum Timeline: CF 6.1 problems..Junior Programmer - NEED HELP!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC