1 Replies - 4167 Views - Last Post: 19 January 2010 - 01:37 PM Rate Topic: -----

#1 webmin  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 256
  • Joined: 21-May 08

Quick Login Script

Posted 14 January 2010 - 08:50 PM

Ok I'm trying to build a small login script and I seem to have hit a wall. The way I have this set up is that I have my users & passwords stored in a database. Here is my form for the user to enter their username & password:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>Untitled</title>
</head>

<body>
<form action="/admin/auth.cfm" method="post" name="details">
<input type="text" size="30" name="uName" value="UserName" onfocus="this.value=''" />
<input type="password" size="30" name="uPass" value="PASSWORD" onfocus="this.value=''" />
<input type="submit" value="Login" /> 
</form>

</body>
</html>



Here is the auth.cfm:

<CFSET checkEntry = #<CFQUERY datasource="airport_brandon">select * from auth where userName = '#FORM.uName' and pass = '#FORM.uPass#'</CFQUERY>#>
<CFIF checkEntry.recordCount NEQ 0>
		 <CFLOCATION URL="admin.cfm">
<CFELSE>
		 <CFOUTPUT>Your Username or Password is wrong! Please try again</CFOUTPUT>
</CFIF>



For some reason it won't load the admin.cfm. Do you have any suggestions? By the way the current auth.cfm gives me this error:

The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.

The following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request
Invalid CFML construct found on line 1 at column 22.

ColdFusion was looking at the following text:
<

The CFML compiler was processing:

< marks the beginning of a ColdFusion tag.Did you mean LT or LTE?
An expression beginning with #, on line 1, column 21.This message is usually caused by a problem in the expressions structure.
A CFSET tag beginning on line 1, column 2.

Resources:
Enable Robust Exception Information to provide greater detail about the source of errors. In the Administrator, click Debugging & Logging > Debug Output Settings, and select the Robust Exception Information option.
Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
Browser Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.38 Safari/532.0
Remote Address
Referrer
Date/Time 14-Jan-10 07:45 PM


I took out the remote address and referrer for privacy reasons. I'm sure this error is something really stupid, and it may be what is preventing me from loading admin.cfm but I've been staring at this too long, and a fresh look might really help. I appreciate any help anyone can offer. Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: Quick Login Script

#2 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1947
  • View blog
  • Posts: 3,488
  • Joined: 13-January 08

Re: Quick Login Script

Posted 19 January 2010 - 01:37 PM

What are you trying to do with this line in your auth.cfm?

<CFSET checkEntry = #<CFQUERY datasource="airport_brandon">select * from auth where userName = '#FORM.uName' and pass = '#FORM.uPass#'</CFQUERY>#>


It looks to me like you're trying to set an unscoped variables called checkEntry with the product of an unnamed cfquery select statement. I've never seen anyone try that and it looks...well...really wrong.

Is checkEntry (you really need to scope your variables BTW as good practice) supposed to act as a success/fail flag for the login attempt?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1