RE: Problem with login code
In your code it looked like the IF's were nested incorrectly. If you query where username=X and password=Y ..the result set you get back is guaranteed to have a username of X and a password of Y ...so their is no need to check in your IF conditions. Your code could be written more compactly like below. I change the check on record count to use exactly one (instead of MaxRows=1), Just in case their are every more than one records in the results set. Your database should have some constraints not allow this to happen...but better safe than sorry...and it dosen't incur a performance hit. BUT, the one big problem I see here is if I ever log in then bookmark the page "webmaster.cfm" I will be able to come back to it. Because, in this logon procedure you don't seem to be setting any session variables something like "Session.logonName = logon.username" so that on the webmaster.cfm page you could include a check to see if the variable exists ...and if not kick the user back to the logon page. SELECT username, password FROM WordJokes WHERE WordJokes.username = '#form.username#' AND WordJokes.password = '#form.password#' Anyway, hope this helps. -eric Common sense is genius dressed in its working clothes. -- Ralph Waldo Emerson Eric Barr Zeff Design (p) 212.714.6390 (f) 212.580.7181 -Original Message- From: Hubert Earl [mailto:[EMAIL PROTECTED]] Sent: Friday, March 02, 2001 5:55 AM To: CF-Talk Subject: Problem with login code 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? SELECT username, password FROM WordJokes WHERE WordJokes.username = '#form.username#' AND WordJokes.password = '#form.password#' 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
RE: Problem with login code
> Do something like this: > > error checking page. > > > > > Actually, Netscape will fail on the message, it should be Personally I don't like or use CFLocation as it causes another CF request when it's not needed I tend to put a CFInclude in the template depending on the outcome of the login Philip Arnold Director Certified ColdFusion Developer ASP Multimedia Limited T: +44 (0)20 8680 1133 "Websites for the real world" ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. ** ~~ 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
RE: Problem with login code
Do something like this: error checking page. Then on login page.alert(#URL.strErrorMsg#); That should do the trick ! ~~ 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
RE: Problem with login code
Why not use the Login Page to validate the User? Jason Lees National Express Email : [EMAIL PROTECTED] -Original Message- From: Hubert Earl [mailto:[EMAIL PROTECTED]] Sent: 02 March 2001 10:55 To: CF-Talk Subject: Problem with login code 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? SELECT username, password FROM WordJokes WHERE WordJokes.username = '#form.username#' AND WordJokes.password = '#form.password#' 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
RE: Problem with login code
Are you passing the variable back to the Login.cfm form? On the Login.cfm page are you displaying the ERRORMESSAGE? You should pass it back to the template and check for its existence and if exists display the message -Original Message- From: Hubert Earl [mailto:[EMAIL PROTECTED]] Sent: Friday, March 02, 2001 5:55 AM To: CF-Talk Subject: Problem with login code 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? SELECT username, password FROM WordJokes WHERE WordJokes.username = '#form.username#' AND WordJokes.password = '#form.password#' 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
Problem with login code
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? SELECT username, password FROM WordJokes WHERE WordJokes.username = '#form.username#' AND WordJokes.password = '#form.password#' 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