Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default simple login form

    hi i am using vs.net with csharp -
    i am trying to create a simple log in form
    user id
    password

    on submit i run a param query to check if the userid and password exist if
    yes i
    would like to store to the contactusername in a session and rediret the user
    to another page -

    q: how do i check if the param select query returned a record and how do i
    access the userid from my sql query to store it in a session("sessUserId")

    thx


    nabil m Guest

  2. Similar Questions and Discussions

    1. Main form and login form in different folders using Forms Authen
      Having a problem on my site when the login form and the main form are in different apps. When the main app redirects to the login form app,...
    2. Simple login script?
      Hello, I wonder if anyone can help me with a very simple login procedure? I have a database (DSN name is mydsn) with fields "username1" and...
    3. SImple portal login
      Hi, Are there any tutorials on how to create a simple user login? Thanks
    4. php login and simple connect
      Hi, JeffreyGong I'm Giuseppe and I'm interested in your website about flashcom! Coule you send me some source code for study? Thank you very...
    5. A simple problem with a really simple form
      Hi there, I'm having a problem with designing a very small form in Dreamweaver. Its just a login form with username and password textfields - the...
  3. #2

    Default simple login form

    hi i am using vs.net with csharp -
    i am trying to create a simple log in form
    user id
    password

    on submit i run a param query to check if the userid and password exist if
    yes i
    would like to store to the contactusername in a session and rediret the user
    to another page -

    q: how do i check if the param select query returned a record and how do i
    access the userid from my sql query to store it in a session("sessUserId")

    thx



    nabil m Guest

  4. #3

    Default Simple Login Form

    I followed the login sample and for some reason once I have logged in it
    doesn't recognize my username and password. I have typed them exactly as they
    are in the database.

    Heres the code:

    <cfif IsDefined("FORM.txtUserName")>
    <cfset MM_redirectLoginSuccess="products.htm">
    <cfset MM_redirectLoginFailed="registration.cfm">
    <cfquery name="MM_rsUser" datasource="BYSRep">
    SELECT Username,password FROM login WHERE Username='#FORM.txtUserName#' AND
    password='#FORM.txtPassword#'
    </cfquery>
    <cfif MM_rsUser.RecordCount NEQ 0>
    <cftry>
    <cflock scope="Session" timeout="30" type="Exclusive">
    <cfset Session.MM_Username=FORM.txtUserName>
    <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>

    I keep getting the redirect failed page for some reason.

    Thanks, Amy

    <cfif IsDefined("FORM.txtUserName")>
    <cfset MM_redirectLoginSuccess="products.htm">
    <cfset MM_redirectLoginFailed="registration.cfm">
    <cfquery name="MM_rsUser" datasource="BYSRep">
    SELECT Username,password FROM login WHERE Username='#FORM.txtUserName#' AND
    password='#FORM.txtPassword#'
    </cfquery>
    <cfif MM_rsUser.RecordCount NEQ 0>
    <cftry>
    <cflock scope="Session" timeout="30" type="Exclusive">
    <cfset Session.MM_Username=FORM.txtUserName>
    <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>

    amystephenson Guest

  5. #4

    Default Re: Simple Login Form

    I coule still use some help on this issue. Please
    amystephenson Guest

  6. #5

    Default Re: Simple Login Form

    i had posted a reply yesterday but it disappeared :confused; anyway - try
    replacing your <cflocation> tags with a javascript window.location command
    instead. <cflocation> tends to override all other code

    gwgiswebmaster Guest

  7. #6

    Default Re: Simple Login Form

    Originally posted by: amystephenson
    I coule still use some help on this issue. Please

    Hi,

    You code is correct, I'm not sure what's wrong but try one of these:

    1) Open the database table and see if the table really has the login
    information that you types in the form

    2) Use the Trim() function in your SQL statement as the following: SELECT
    Username,password FROM login WHERE Username='#trim(FORM.txtUserName)#' AND
    password='#trim(FORM.txtPassword)#'

    3) In your Application.cfm file, increase the session time out, something like
    this: <cfapplication name="myApplication" sessionmanagement="yes"
    sessiontimeout="#createTimeSpan(0,0,20,0)#">

    4) Remove the CFLock code

    If nothing of the above solves the problem, then there must be some bug that
    I'm not aware about in your code :)

    Goodluck

    externalError Guest

  8. #7

    Default Re: Simple Login Form

    Are you getting any records? Is the cflock error happening? If so it
    will fall through to the :
    <cflocation url="#MM_redirectLoginFailed#" addtoken="no">
    line. Where does URL.accessdenied come from. It really has no use
    because <cfif IsDefined("URL.accessdenied") AND false> is always
    false so URL.accessdenied is never used.

    OldCFer 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