Hi everyone,

The code below is a loginaction template.  It's supposed to give an error
message if the wrong id or password is given on a login form, or if either
or both aren't given.  Instead, it only gives the message if something is
missing.  If something is wrong, it simply sends the user back to the login
page, with no error message.  Is it possible to 'tweak' the code to get it
to work (and if so, can you please suggest how to do so), or is there
something so fundamentally wrong with it that it needs to be rewritten from
scratch?

<!---authenticate the user against the database--->

<CFQUERY NAME="login" DATASOURCE="Jokes" MAXROWS="1">
 SELECT username, password
 FROM   WordJokes
 WHERE  WordJokes.username = '#form.username#' AND
        WordJokes.password = '#form.password#'
</CFQUERY>

<CFIF LOGIN.RECORDCOUNT GT 0>
  <CFIF LOGIN.PASSWORD IS FORM.PASSWORD>

  <!---user has been authenticated; send the user to the proper page--->

  <CFLOCATION URL="webmaster.cfm">
  <CFELSE>

  <!---login failed -- send them back to the login screen--->

  <CFSET ERRORMESSAGE="You must enter a valid password and user name to
enter this site">
  <CFLOCATION URL="login.cfm">
 </CFIF>
<CFELSE>

<!---login failed - send them back to the login page--->

  <CFSET ERRORMESSAGE="You must enter a valid password and user name to
enter this site">
  <CFLOCATION URL="login.cfm">
</CFIF>

Sincerely,

---
Hubert Earl

ICQ#: 16199853

See pictures of items in my Jamaican Art, Craft & More Store Online Sale on
my "Me" page on eBay (this tells you a little about myself, including a
photo), and there's a link to the auctions themselves:
http://members.ebay.com/aboutme/hearl1/

See pictures of all items I have:
http://www.angelfire.com/ny/hearl/link_page_on_angelfire.html




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to