Log in

View Full Version : help with validating a user. if exist "allow" else "error"



Hollywood
01-24-2010, 11:49 AM
hi everyone
please can anyone help me with how to validate a user-name's existence in a database. i.e. allow the user to access the requested page if the user-name exist in the database else display an error message
i'm using Microsoft access database platform and the server technology is cold-fusion
i hope i'm in the right section?
any assistance will be highly appreciated.
thanks

djr33
01-24-2010, 09:38 PM
I don't know access (are you using ASP also?), but here's the simple answer:
Using your framework (in ASP? PHP? CGI?) for users, you will need to determine the user name. Then do a query to see if it exists in the database. If it does, do nothing. If not, redirect or display a blank page.

But in order to help specifically, you'd need to explain a lot more about how your site works and probably post some code.

Hollywood
01-25-2010, 08:19 AM
ok
i have a login page that look like this
<cfform action="results.cfm" name="login">
<cfinput type="text" name="username"><br/>
<cfinput type="text" name="regnumber"><br/>
<cfinput type="sumbit" name="submit">
</cffrom>

and the results page looks like this:

<cfquery name="GetResults" datasource="mydatabase">
SELECT* FROM RESULTS
WHERE UserName = <cfqueryparam value="#Form.UserName#" CFSQLType="CF_SQL_VARCHAR">
AND regnumber = <cfqueryparam value="#Form.regnumber#" CFSQLType="CF_SQL_VARCHAR">
</cfquery>

Note:mydabatase is the Microsoft access database while results is the name of the table to display the data from.

the problem now is when the input fields in the login page is field with correct data from the table the results page will display as wanted but when the input fields are filled with wrong data the results page will be blank with nothing on it so i want an error message to display when the login page is field with wrong data.
i hope i'm making sense here because i tried to explain it the best way i could.


and please can you offer suggestions on how to do away with Microsoft access because i'm even tired of it, it is too complex for me.

thanks for the help