View Full Version : help with validating a user. if exist "allow" else "error"
01-24-2010, 10:49 AM
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.
01-24-2010, 08: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.
01-25-2010, 07:19 AM
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">
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">
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
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.