Forums

This topic is locked

Login varification problems

Posted 07 Jan 2008 12:39:56
1
has voted
07 Jan 2008 12:39:56 Robin Ford posted:
HI, I am building a login page for an intranet site using Dreamweaver CS3, Coldfusion 8, and Mysql.
I have the Mysql data source registered in Coldfusion, this can be accessed from the login page. all that is working fine but, if i try a test login it fails every time no matter who's login i use.
I wrote a test query and that is returning the right data but, If i login i am directed to the login failed page despite the login code being written by Dreamweaver itself! The server behaviour is for verification by username and password only (not using the access level option).
I can't see where the problem is.

Any thoughts or suggestions welcome.

Regards

Rob Ford

Replies

Replied 09 Jan 2008 23:37:07
09 Jan 2008 23:37:07 Javier Castro replied:
You should post your code for others to see. The more eyes, the more help you could get.
Replied 10 Jan 2008 12:38:37
10 Jan 2008 12:38:37 Robin Ford replied:
Hi Javier,
Thanks for the advice and so here is the code........

<pre id=code><font face=courier size=2 id=code>&lt;cfif IsDefined("FORM.User_Name"&gt;
&lt;cfset MM_redirectLoginSuccess="welcome.cfm"&gt;
&lt;cfset MM_redirectLoginFailed="failed.cfm"&gt;
&lt;cfquery name="MM_rsUser" datasource="Intranet" username="legion" password="legion1"&gt;
SELECT user_name,password FROM users WHERE user_name=&lt;cfqueryparam value="#FORM.User_Name#" cfsqltype="cf_sql_clob" maxlength="15"&gt; AND password=&lt;cfqueryparam value="#FORM.Password#" cfsqltype="cf_sql_clob" maxlength="9"&gt;
&lt;/cfquery&gt;
&lt;cfif MM_rsUser.RecordCount NEQ 0&gt;
&lt;cftry&gt;
&lt;cflock scope="Session" timeout="30" type="Exclusive"&gt;
&lt;cfset Session.MM_Username=FORM.User_Name&gt;
&lt;cfset Session.MM_UserAuthorization=""&gt;
&lt;/cflock&gt;
&lt;cfif IsDefined("URL.accessdenied" AND false&gt;
&lt;cfset MM_redirectLoginSuccess=URL.accessdenied&gt;
&lt;/cfif&gt;
&lt;cflocation url="#MM_redirectLoginSuccess#" addtoken="no"&gt;
&lt;cfcatch type="Lock"&gt;&lt;!--- code for handling timeout of cflock ---&gt;
&lt;/cfcatch&gt;
&lt;/cftry&gt;
&lt;/cfif&gt;
&lt;cflocation url="#MM_redirectLoginFailed#" addtoken="no"&gt;
&lt;cfelse&gt;
&lt;cfset MM_LoginAction=CGI.SCRIPT_NAME&gt;
&lt;cfif CGI.QUERY_STRING NEQ ""&gt;
&lt;cfset MM_LoginAction=MM_LoginAction & "?" & XMLFormat(CGI.QUERY_STRING)&gt;
&lt;/cfif&gt;
&lt;/cfif&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;style type="text/css"&gt;
&lt;!--
.style5 {
font-family: Arial, Helvetica, sans-serif;
color: #0000FF;
font-weight: bold;
}
--&gt;
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;form action="&lt;cfoutput&gt;#MM_loginAction#&lt;/cfoutput&gt;" method="POST" name="form1" class="style5" id="form1"&gt;
&lt;p&gt;Welcome to the Cottage Intranet site&lt;/p&gt;
&lt;p&gt;Please Login&lt;/p&gt;
&lt;p&gt;
&lt;label&gt;User Name
&lt;input type="text" name="User_Name" id="User_Name" /&gt;
&lt;/label&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;label&gt;Password
&lt;input type="text" name="Password" id="Password" /&gt;
&lt;/label&gt;
&lt;/p&gt;
&lt;p&gt;&nbsp;&lt;/p&gt;
&lt;p&gt;
&lt;input type="submit" name="Submit" id="Submit" value="Submit" /&gt;
&lt;/p&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</font id=code></pre id=code>

As you can see it is bog standard dreamweaver code with CFML and SQL written by the Server behaviour wizard.
Ihave tested that it is all working by writing some code to coparing the form data with the Db entries and retrieving the data and displayingnit in a table. But when run with the included code I get a Login Failed page every time!

Any help will be apreciated.

Rob Ford
Replied 11 Jan 2008 06:03:07
11 Jan 2008 06:03:07 Javier Castro replied:
Hi Robin,

I looked at your code but since I'm not a CF user, I got lost. I must say, that this site is great but at times it gets cold and replies are hard to come by. I would suggest to look for
a CF dedicated group to enquire as a back up, in case no one answers to your question.
Sorry..

Javier

Reply to this topic