Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Log in User

    I have just downloaded Cold fusion 7 and have it up and running fine, problem
    is when I try to use the Log-in user Server Behaviour on the page, it wont
    recognize when a correct username and password has been entered and direct to
    the page set. I have posted the code of my test below, I cant see what I am
    doing wrong as I have set this up in ASP lots of times without this issue?.any
    help would be great.

    <cfif IsDefined("FORM.textfield")>
    <cfset MM_redirectLoginSuccess="main.cfm">
    <cfset MM_redirectLoginFailed="default.cfm">
    <cfquery name="MM_rsUser" datasource="cfttest">
    SELECT rsusername,rspassword FROM users WHERE rsusername='#FORM.textfield#'
    AND rspassword='#FORM.textfield1#'
    </cfquery>
    <cfif MM_rsUser.RecordCount NEQ 0>
    <cftry>
    <cflock scope="Session" timeout="30" type="Exclusive">
    <cfset Session.MM_Username=FORM.textfield>
    <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 HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    </head>

    <body>
    <form ACTION="<cfoutput>#MM_loginAction#</cfoutput>" name="form1"
    method="POST">
    <table width="100%" >
    <tr>
    <td><input type="text" name="textfield">
    <input name="textfield1" type="text" id="textfield1">
    <input type="submit" name="Submit" value="Submit"></td>
    <td>&nbsp;</td>
    </tr>
    </table>
    </form>
    </body>
    </html>

    camenzka Guest

  2. Similar Questions and Discussions

    1. Web Service uses ASPNET user although changed to administrator user in IIS
      Hi My problem is this In the Website (of my webservice) in the IIS, I've changed the ASPNET user in the Directory Security to administrator user,...
    2. user levels, cell phones, and user registration, plus cookies
      I need to quote a client on the following and need to know how much work is involved, ie hours. The programming may be done in PHP (unless its...
    3. Can we fire a user control event when the user does the action
      Can we fire a user control event when the user does the action not in the webservers or custom control event? What actaully I want is to handle a...
    4. Number of admin user accounts and old user name still working
      Is it recommended to have more than one administrator for a computer? The reason I ask is I read that the built-in administrator account is only...
    5. User changing something on a form makes asp.net take user to login page
      Hi, I have an application that displays the database table records on the web page, the user can navigate thru the contents and make changes and...
  3. #2

    Default Re: Log in User

    Do you have an Application.cfm page that allows session variables?

    [url]http://www.macromedia.com/go/tn_16564[/url]

    --
    Ken Ford
    PVII Support Team
    [url]http://www.projectseven.com[/url]
    Team Macromedia Volunteer - Dreamweaver
    Certified Dreamweaver MX 2004 Developer


    "camenzka" <webforumsuser@macromedia.com> wrote in message news:d0v3sa$7ps$1@forums.macromedia.com...
    >I have just downloaded Cold fusion 7 and have it up and running fine, problem
    > is when I try to use the Log-in user Server Behaviour on the page, it wont
    > recognize when a correct username and password has been entered and direct to
    > the page set. I have posted the code of my test below, I cant see what I am
    > doing wrong as I have set this up in ASP lots of times without this issue?.any
    > help would be great.
    >
    > <cfif IsDefined("FORM.textfield")>
    > <cfset MM_redirectLoginSuccess="main.cfm">
    > <cfset MM_redirectLoginFailed="default.cfm">
    > <cfquery name="MM_rsUser" datasource="cfttest">
    > SELECT rsusername,rspassword FROM users WHERE rsusername='#FORM.textfield#'
    > AND rspassword='#FORM.textfield1#'
    > </cfquery>
    > <cfif MM_rsUser.RecordCount NEQ 0>
    > <cftry>
    > <cflock scope="Session" timeout="30" type="Exclusive">
    > <cfset Session.MM_Username=FORM.textfield>
    > <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 HTML 4.01 Transitional//EN"
    > "http://www.w3.org/TR/html4/loose.dtd">
    > <html>
    > <head>
    > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    > <title>Untitled Document</title>
    > </head>
    >
    > <body>
    > <form ACTION="<cfoutput>#MM_loginAction#</cfoutput>" name="form1"
    > method="POST">
    > <table width="100%" >
    > <tr>
    > <td><input type="text" name="textfield">
    > <input name="textfield1" type="text" id="textfield1">
    > <input type="submit" name="Submit" value="Submit"></td>
    > <td>&nbsp;</td>
    > </tr>
    > </table>
    > </form>
    > </body>
    > </html>
    >

    Ken Ford - *TMM* & PVII Guest

  4. #3

    Default Re: Log in User

    Thanks Ken

    All sorted with that..works fine now.
    camenzka Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139