cfcode
asked on
security
What is the best way to make a simple login form that verifies username, password and access level against an existing database? There are 5 levels of users. Each level of user gets sent to a different CF page within the site.
ASKER
I am looking for the code to do this and/or some already existing custom tags that address this.
make a table called users with:
username, password, securitylevel, startpage, (etc)
make auth.cfm like:
========================== ========== ===
<cfquery name=auth .. .. ..>
select * from users where username='#form.username#' and password='#form.password#'
</cfquery>
<cfif auth.recordcount>
<cfset session.securitylevel=auth .securityl evel>
<cfset session.username=auth.user name>
location.href="#auth.start page#"
<cfelse>
Bad Password or unknown user
</cfif>
<cfif not isdefined('session.securit ylevel')>
Please log in:<br>
<form action="auth.cfm" method="post">
Username: <input name=username><br>
Password: <input type=password name=password>
<input type=submit value="LOG IN">
</form>
</cfif>
========================== ========== ===
cheers.
username, password, securitylevel, startpage, (etc)
make auth.cfm like:
==========================
<cfquery name=auth .. .. ..>
select * from users where username='#form.username#'
</cfquery>
<cfif auth.recordcount>
<cfset session.securitylevel=auth
<cfset session.username=auth.user
location.href="#auth.start
<cfelse>
Bad Password or unknown user
</cfif>
<cfif not isdefined('session.securit
Please log in:<br>
<form action="auth.cfm" method="post">
Username: <input name=username><br>
Password: <input type=password name=password>
<input type=submit value="LOG IN">
</form>
</cfif>
==========================
cheers.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What are you wanting the CODE to do this or the way to do this???