p.s you dont mind in helping me if i get any other problems!!!
From: [EMAIL PROTECTED] Reply-To: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Subject: RE: [ cf-dev ] login tutorial Date: Tue, 9 Mar 2004 16:06:57 +0000
ok, for a login script there's probably 3 things to watch out for:
- nothing entered for username and/or password - this username/password combination not found - this username/password combination was found
I'd do it something like this:
login.cfm:
<cfparam name="URL.error" default="">
<form name="login" action="process_login.cfm" method="POST"> <cfif URL.error EQ "Length"> Please enter something for both Username and Password<br> <cfelseif URL.error EQ "NotFound"> This Username and Password wasn't found. Please try again<br> </cfif>
Username: <input type="text" name="Username"><br> Password: <input type="password" name="Password"><br> <input type="Submit" value="Login"> </form>
process_login.cfm:
<cfparam name="Form.Username" default=""> <cfparam name="Form.Password" default="">
<cfif NOT Len(Trim(Form.Username)) OR NOT Len(Trim(Form.Password))> <!--- one or both of these is blank, redirect them ---> <cflocation url="login.cfm?error=Length"> </cfif>
<cfquery name="qVerify" datasource="userLogin"> SELECT user_name, user_pass FROM tblAdmins WHERE user_name = '#Form.Username#' AND user_pass = '#Form.Password#' </cfquery>
<cfif NOT qVerify.RecordCount> <!--- no results found, redirect them ---> <cflocation url="login.cfm?error=NotFound"> <cfelse> <!--- Found their details, take them to the members-only page ---> <cflocation url="members_only.cfm"> </cfif>
"sanjay sidar"
<[EMAIL PROTECTED] To: [EMAIL PROTECTED]
tmail.com> cc:
Subject: RE: [ cf-dev ] login tutorial
09/03/2004 15:57
Please respond
to dev
i agree with what you are saying, and besides i dont have a clue about javascript, so how would i redirect the page if a wrong username and password are entered?
>From: [EMAIL PROTECTED] >Reply-To: <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Subject: RE: [ cf-dev ] login tutorial >Date: Tue, 9 Mar 2004 15:53:58 +0000 > > >you must have uncommented the cflocation in the 'else' segment i guess. >remove that line, and instead just say: > ><cfelse> > <!--- this user did not log in correctly, alert and redirect to the >login page ---> > Your username and password were not found. ></cfif> > >You need to decide though how you're going to deal with errors. The line >above will just display the error on the page. The example given on that >tutorial uses Javascript to warn users. My preference would be to redirect >them back to the page with the login form, passing a URL parameter to >indicate there was an error. > > >Duncan Cumming >IT Manager > >http://www.alienationdesign.co.uk >mailto:[EMAIL PROTECTED] >Tel: 0141 575 9700 >Fax: 0141 575 9600 > >Creative solutions in a technical world > >---------------------------------------------------------------------- >Get your domain names online from: >http://www.alienationdomains.co.uk >Reseller options available! >---------------------------------------------------------------------- >---------------------------------------------------------------------- > > > > "sanjay sidar" > <[EMAIL PROTECTED] To: >[EMAIL PROTECTED] > tmail.com> cc: > Subject: RE: [ cf-dev ] >login tutorial > 09/03/2004 15:46 > Please respond > to dev > > > > > >Duncan, > >i tried copying the code you had sent me, but now after trying to login, it > >gets sent to an error page, i have not inserted anything into the sql >database, so hence there are no records of any members, so if i type in a >member should it not state that i am an unauthorsed user instead of going >to >an error page! > >sanjay > > >From: [EMAIL PROTECTED] > >Reply-To: <[EMAIL PROTECTED]> > >To: <[EMAIL PROTECTED]> > >Subject: RE: [ cf-dev ] login tutorial > >Date: Tue, 9 Mar 2004 15:14:42 +0000 > > > > > >one thing, for some reason they're relying on javascript to do a >redirect, > >and display an annoying 'welcome' message. dump that bit, and replace >with > >a cflocation or stick in some tracer code to show you if it reaches that. > > > >how about this for a modified version: > > > ><cfquery name="qVerify" datasource="userLogin"> > > SELECT user_name, user_pass > > FROM tblAdmins > > WHERE user_name = '#user_name#' > > AND user_pass = '#user_pass#' > ></cfquery> > > > ><cfdump var="#qVerify#"> > > > > > ><cfif qVerify.RecordCount> > > <!--- This user has logged in correctly, change the value of the
>session.allowin value --->
> > <cfset session.allowin = "True">
> > <!--- Now redirect to "members_only.cfm" --->
> > Redirect to members only <!--- commented out the cflocation just
>now
>--->
> > <!--- <cflocation url="members_only.cfm"> --->
> >< cfelse>
> > <!--- this user did not log in correctly, alert and redirect to the
> >login page --->
> > Nothing found <!--- commented out the cflocation just now --->
> > <!--- <cflocation url="page.cfm?error=notfound"> --->
> ></cfif>
> >
> >
> >At least this way you should be able to see what you're getting back
from
> >the query, and which part of your if-else statement executes.
> >
> >
> >Duncan Cumming
> >IT Manager
> >
> >http://www.alienationdesign.co.uk
> >mailto:[EMAIL PROTECTED]
> >Tel: 0141 575 9700
> >Fax: 0141 575 9600
> >
> >Creative solutions in a technical world
> >
> >----------------------------------------------------------------------
> >Get your domain names online from:
> >http://www.alienationdomains.co.uk
> >Reseller options available!
> >----------------------------------------------------------------------
> >----------------------------------------------------------------------
> >
> >
> >
> > "sanjay sidar"
> > <[EMAIL PROTECTED] To:
> >[EMAIL PROTECTED]
> > tmail.com> cc:
> > Subject: RE: [ cf-dev ]
> >login tutorial
> > 09/03/2004 14:45
> > Please respond
> > to dev
> >
> >
> >
> >
> >
> >hey guys i have this code copied from: http://tutorial8.easycfm.com/
> >
> >and i cant seem to get anything displayed, would anyone be able to tell
>me
> >whats wrong
> >
> ><cfquery name="qVerify" datasource="userLogin">
> > SELECT user_name, user_pass
> > FROM tblAdmins
> > WHERE user_name = '#user_name#'
> > AND user_pass = '#user_pass#'
> ></cfquery>
> >
> ><cfif qVerify.RecordCount>
> > <!--- This user has logged in correctly, change the value of the
>session.allowin value --->
> > <cfset session.allowin = "True">
> > <!--- Now welcome user and redirect to "members_only.cfm" --->
> > <script>
> > alert("Welcome user, you have been successfully logged in!");
> > self.location="/members_only.cfm";
> > </script>
> >< cfelse>
> > <!--- this user did not log in correctly, alert and redirect to the
> >login page --->
> > <script>
> > alert("Your credentials could not be verified, please try
> >again!!!");
> > self.location="Javascript:history.go(-1)";
> > </script>
> ></cfif>
> >
> >_________________________________________________________________
> >Use MSN Messenger to send music and pics to your friends
> >http://www.msn.co.uk/messenger
> >
> >
> >--
> >These lists are syncronised with the CFDeveloper forum at
> >http://forum.cfdeveloper.co.uk/
> >Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> >
> >CFDeveloper Sponsors and contributors:-
> >*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF
>provided
> >by activepdf.com*
> > *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
> >proworkflow.com*
> > *Tutorials provided by helmguru.com* :: *Lists hosted by
> >gradwell.com*
> >
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> >
> >
> >--
> >These lists are syncronised with the CFDeveloper forum at
> >http://forum.cfdeveloper.co.uk/
> >Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> >
> >CFDeveloper Sponsors and contributors:-
> >*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF
>provided
>
> >by activepdf.com*
> > *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
> >proworkflow.com*
> > *Tutorials provided by helmguru.com* :: *Lists hosted by
> >gradwell.com*
> >
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >
>
>_________________________________________________________________
>It's fast, it's easy and it's free. Get MSN Messenger today!
>http://www.msn.co.uk/messenger
>
>
>--
>These lists are syncronised with the CFDeveloper forum at
>http://forum.cfdeveloper.co.uk/
>Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
>CFDeveloper Sponsors and contributors:-
>*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
>by activepdf.com*
> *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
>proworkflow.com*
> *Tutorials provided by helmguru.com* :: *Lists hosted by
>gradwell.com*
>
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>
>
>
>
>
>
>--
>These lists are syncronised with the CFDeveloper forum at
>http://forum.cfdeveloper.co.uk/
>Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
>CFDeveloper Sponsors and contributors:-
>*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
>by activepdf.com* > *Forums provided by fusetalk.com* :: *ProWorkFlow provided by >proworkflow.com* > *Tutorials provided by helmguru.com* :: *Lists hosted by >gradwell.com* > >To unsubscribe, e-mail: [EMAIL PROTECTED] >
_________________________________________________________________ Tired of 56k? Get a FREE BT Broadband connection http://www.msn.co.uk/specials/btbroadband
-- These lists are syncronised with the CFDeveloper forum at http://forum.cfdeveloper.co.uk/ Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
CFDeveloper Sponsors and contributors:- *Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by activepdf.com* *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com* *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*
To unsubscribe, e-mail: [EMAIL PROTECTED]
--
These lists are syncronised with the CFDeveloper forum at http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by activepdf.com*
*Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
*Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*
To unsubscribe, e-mail: [EMAIL PROTECTED]
_________________________________________________________________ Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo
-- These lists are syncronised with the CFDeveloper forum at http://forum.cfdeveloper.co.uk/ Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by
activepdf.com*
*Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
*Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*To unsubscribe, e-mail: [EMAIL PROTECTED]
