Link to home
Start Free TrialLog in
Avatar of cfcode
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.
Avatar of Nathan Stanford Sr
Nathan Stanford Sr
Flag of United States of America image


What are you wanting the CODE to do this or the way to do this???


Avatar of cfcode
cfcode

ASKER

I am looking for the code to do this and/or some already existing custom tags that address this.
Avatar of meverest
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.securitylevel>

<cfset session.username=auth.username>

location.href="#auth.startpage#"

<cfelse>

Bad Password or unknown user

</cfif>

<cfif not isdefined('session.securitylevel')>

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
Avatar of acampoma
acampoma

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial