I would just do a little different. Just check that username isDefined 
and is not ""


<CFIF IsDefined("form.username")>
<CFIF form.username IS NOT "">
<!---  --->
 <CFQUERY name="getUser" datasource="CFSQL">
SELECT
 ID,
 Password
FROM tblUser
WHERE ID='#Form.userName#' AND password='#Form.password#'
 </CFQUERY>
<!---  --->
 <CFIF getUser.RecordCount GT 0>
  <CFSET SESSION.loggedIn="yes">
  <CFLOCATION url="index.cfm">
 <CFELSE>
  <CFLOCATION url="login.cfm?failed=yes">
 </CFIF>
</CFIF>
<CFIF IsDefined("URL.failed")>
 <CFSET errMsg="Login Failed, Please Try Again">
<CFELSEIF IsDefined("URL.notLoggedIn")>
 <CFSET errMsg="User Not Logged In">
<CFELSE>
 <CFSET errMsg="Please Login Below">
</CFIF>
</CFIF>
<CENTER><BR><H3><B>Welcome to NZERN Members Website</B></H3><BR><H4>
<!--- gives error message on web page --->
<CFOUTPUT>
#errMsg#
</CFOUTPUT>
</H4><BR><BR><!--- form to login --->
<FORM action="login.cfm?login=yes" method="post"><!---  enter user 
name--->
 UserName
 <INPUT type="text" name="userName"><BR><!--- enter password --->
 Password
 <INPUT type="password" name="password"><BR>
 <INPUT type="submit" value=" Login ">

There are two major products that come out of Berkeley: LSD and [Unix] 
BSD. We don't believe this to be a coincidence.



Doug Brown
----- Original Message ----- 
From: "Martin Sutton" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, February 08, 2002 1:41 AM
Subject: RE: Password Protection - whats wrong with this


> Mike,
> 
> I think this might have something to do with the way url variables are
> handled in action parameters of forms.  I am not 100% sure but I don't 
think
> that appending variables within action="" is fully valid HTML 4.01 
mark-up,
> I know that some user agents (browsers) handle this differently.  
Maybe it
> is only recognising the variables contained in that action URL.
> 
> Try putting the variable "login" into a hidden field instead.  
Reference it
> within the form scope, eg.  isDefined("form.login").
> 
> <input type="hidden" name="login" value="yes">
> 
> I hope this helps.
> 
> Regards,
> 
> Martin.
> 
> -----Original Message-----
> From: Office [mailto:[EMAIL PROTECTED]]
> Sent: 07 February 2002 21:06
> To: CF-Talk
> Subject: Password Protection - whats wrong with this
> 
> 
> Oops!
> I've taken out the HTML so it won't appear as a web page
> Mike
> 
> 
> Hi I can't get this to work.It looks for data from SQL7 table called 
tblUser
> I've been fiddling with it but obviously missing something.
> Can anyone spot the error
> ---------------------------------
> 
> <CFIF IsDefined("URL.Login")><!---  --->
>  <CFQUERY name="getUser" datasource="CFSQL">
> SELECT
>  ID,
>  Password
> FROM tblUser
> WHERE ID='#Form.userName#' AND password='#Form.password#'
>  </CFQUERY>
> <!---  --->
>  <CFIF getUser.RecordCount GT 0>
>   <CFSET SESSION.loggedIn="yes">
>   <CFLOCATION url="index.cfm">
>  <CFELSE>
>   <CFLOCATION url="login.cfm?failed=yes">
>  </CFIF>
> </CFIF>
> <CFIF IsDefined("URL.failed")>
>  <CFSET errMsg="Login Failed, Please Try Again">
> <CFELSEIF IsDefined("URL.notLoggedIn")>
>  <CFSET errMsg="User Not Logged In">
> <CFELSE>
>  <CFSET errMsg="Please Login Below">
> </CFIF>
> <CENTER><BR><H3><B>Welcome to NZERN Members Website</B></H3><BR><H4>
> <!--- gives error message on web page --->
> <CFOUTPUT>
> #errMsg#
> </CFOUTPUT>
> </H4><BR><BR><!--- form to login --->
> <FORM action="login.cfm?login=yes" method="post"><!---  enter 
user name--->
>  UserName
>  <INPUT type="text" name="userName"><BR><!--- enter password --->
>  Password
>  <INPUT type="password" name="password"><BR>
>  <INPUT type="submit" value=" Login ">
> --------------------
> Error Diagnostic Information
> 
> An error occurred while evaluating the expression:
> 
> 
> #Form.userName#
> 
> 
> 
> Error near line 23, column 18.
> 
-------------------------------------------------------------------------
---
> ----
> 
> Error resolving parameter FORM.USERNAME
> 
> 
> The specified form field cannot be found. This problem is very likely 
due to
> the fact that you have misspelled the form field name.
> 
> 
> 
> The error occurred while processing an element with a general 
identifier of
> (#Form.userName#), occupying document position (23:17) to (23:31).
> 
> 
> Date/Time: 02/08/02 09:55:00
> Browser: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
> Remote Address: 210.86.52.9
> Query String: login=yes
> 
> -------------------------------------------
> 
> 
> thanks in advance for any help
> (I'm a newbee)
> Mike
> ----------------------------------------------------
> NZERN
> Mail: PO Box 9000, Christchurch
> (03) 338-5451
> E-mail: [EMAIL PROTECTED]
> http://www.bush.org.nz
> ----------------------------------------------------
> 
> 
> 
> 
> 
______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to