Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

LOGIN not working

New Here ,
Apr 20, 2006 Apr 20, 2006
I used application objects/User authentication to build this login page. I, also, set session management = "yes" in my Application.cfm. Still, the login page will not take me to the next page qry_jobtkt.cfm. I don't get a database error either.
Am I missing something?
Here is the code:
<cfapplication name="Graphics" >
<cfif IsDefined("FORM.username")>
<cfset MM_redirectLoginSuccess="qry_jobtkt.cfm">
<cfset MM_redirectLoginFailed="index.cfm">
<cfquery name="MM_rsUser" datasource="qords" username="dw" password="9">
SELECT username,password FROM dbo.users WHERE username='#FORM.username#' AND password='#FORM.password#'
</cfquery>
<cfif MM_rsUser.RecordCount NEQ 0>
<cftry>
<cflock scope="Session" timeout="30" type="Exclusive">
<cfset Session.MM_Username=FORM.username>
<cfset Session.MM_UserAuthorization="">
</cflock>
<cfif IsDefined("URL.accessdenied") AND false>
<cfset MM_redirectLoginSuccess=URL.accessdenied>
</cfif>
<cflocation url="#MM_redirectLoginSuccess#" addtoken="no">
<cfcatch type="Lock">
<!--- code for handling timeout of cflock --->
</cfcatch>
</cftry>
</cfif>
<cflocation url="#MM_redirectLoginFailed#" addtoken="no">
<cfelse>
<cfset MM_LoginAction=CGI.SCRIPT_NAME>
<cfif CGI.QUERY_STRING NEQ "">
<cfset MM_LoginAction=MM_LoginAction & "?" & XMLFormat(CGI.QUERY_STRING)>
</cfif>
</cfif>
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>GRAPHICS</title>
</head>
<html>
<body>

<form>
<input name="GRAPHICS" type="text" value="GRAPHICS BILLING" size="30" maxlength="20" readonly="true" />
<form action="<cfoutput>#MM_loginAction#</cfoutput>" method="POST" name="index" >
<input name="username" type="text" size="20" maxlength="20" id="User"/>
<input name="password" type="password" size="10" maxlength="10" ID="Password"/>
<input name="SUBMIT" type="submit" value="SUBMIT">





</form>

</body>

</html>
TOPICS
Getting started
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 21, 2006 Apr 21, 2006
The line, <cfapplication name="Graphics" >, initializes a brand new application. I would suppose that the session structure that has been in effect up to this point, would no longer apply after this tag. After the tag, Coldfusion could create a new session structure for the Graphics application. However, you would then have to redefine the session attributes
<cfapplication sessionmanagement="yes"...etc>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 21, 2006 Apr 21, 2006
I also see that you have an input field called "graphics" as well. Normally this doesnt matter too much, but as a rule of thumb, all variables should be uniquely named.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2006 Apr 21, 2006
My Application.cfm file is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Application</title>
</head>
<!--- Set application name and enable Client and Session variables --->


<cfapplication name="Graphics" sessionmanagement="Yes" sessiontimeout="#CreateTimeSpan(0,0,15,0)#">

<body>
</body>
</html>

The login didn't take me to qry_jobtkt.cfm so that's when I put <cfapplication name="Graphics" > into the login.cfm file. Now, I have redefined the sessionmanagement=yes in the login file and still the login is not executing qry_jobtkt.cfm.

I'm not sure how CF connects the files in an application. Is it just because they're in the same directory that they are included in one application?


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 21, 2006 Apr 21, 2006
Some suggestions

1) Application.cfm should, as a rule, not contain HTML code. All you need to do is save

<cfapplication name="Graphics" sessionmanagement="Yes" sessiontimeout="#CreateTimeSpan(0,0,15,0)#">

as Application.cfm, and develop it from there.

2) Your explanation makes things clearer. You should delete the tag <cfapplication name="Graphics" > from your first post.

3) Application.cfm is simply an agreement you have with Coldfusion. Coldfusion will run the code in that file before it runs any request. Generally speaking, the sum total of all the pages and directories containing pages that Coldfusion runs after it has run a given Application.cfm are called an application. That depends on the location of Application.cfm in the directory structure.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2006 Apr 21, 2006
I followed your suggestions but I am having no success getting the login to work. Is there a way to trace the code executing so I can relay it to a support person who might be able to identify where it is failing?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 22, 2006 Apr 22, 2006
I performed the following changes:

(i) deleted the extra <form> tag and moved the correct one to a position above all the form-elements

(ii) added closing tag to form field, submit

(iii) deleted the code block:
</cfif>
<cflocation url="#MM_redirectLoginFailed#" addtoken="no">


(iv) moved the following block out of the if-statement, so that, now, it always is in the same request scope as the very form which requires the variable, MM_LoginAction
<cfset MM_LoginAction=CGI.SCRIPT_NAME>
<cfif CGI.QUERY_STRING NEQ "">
<cfset MM_LoginAction=MM_LoginAction & "?" & XMLFormat(CGI.QUERY_STRING)>
</cfif>


(v) placed the following tag within the else-statement
<cflocation url="#MM_redirectLoginFailed#" addtoken="no">

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 24, 2006 Apr 24, 2006
Thank you. That worked!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 25, 2006 Apr 25, 2006
LATEST
!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources