sjha81
asked on
Login Page/Process/Application: Creating multi-level permissions or access. 500
I am trying to figure out how to create two user groups whom have different priveleges and essentially different menus.
1. Administrator
2. Registered Users
I have been testing the cfswitch and cfcase tags; however, have a problem implementing them. Any suggestions or any formats that you can share will be greatly appreciated!
Experienced insight please.
-------------------------- ---------- ---------- ---------- ---------
<cfswitch expression="#usergroup#">
<cfcase value="1">
<cfinclude template="protectedgrouppa ges/page1. cfm">
</cfcase>
<cfcase value="2">
<cfinclude template="protectedgrouppa ges/page2. cfm">
</cfcase>
... more cfcase as neccesary ..
<cfdefaultcase>
place an error like "there is no such user group"
</cfdefaultcase>
</cfswitch>
-------------------------- ---------- ---------- ---------- -------
logprocess.cfm
------------------
<cfquery datasource="real" name="x">
SELECT *
FROM users
WHERE (trim(users.username)='#tr im(FORM.us ername)#')
AND (trim(users.password)='#tr im(FORM.pa ssword)#')
</cfquery>
<CFIF x.RecordCount GT 0>
<CFSET Session.loggedIn=True>
<CFLOCATION url="../secure2/index.cfm" addtoken="No">
<CFELSE>
<CFLOCATION url="badlogin.cfm">
</CFIF>
Application.cfm
-------------
<CFAPPLICATION NAME="x" sessionmanagement="YES" clientmanagement="NO" setclientcookies="YES" SESSIONTIMEOUT="#CreateTim eSpan(0, 0, 15, 0)#">
<CFPARAM NAME="Session.loggedIn" DEFAULT="False">
<CFIF ((Session.loggedIn IS "False") AND (NOT (FindNoCase("logprocess", "#CGI.SCRIPT_NAME#"))))>
<CFLOCATION url="login.cfm" addtoken="no">
</cfif>
1. Administrator
2. Registered Users
I have been testing the cfswitch and cfcase tags; however, have a problem implementing them. Any suggestions or any formats that you can share will be greatly appreciated!
Experienced insight please.
--------------------------
<cfswitch expression="#usergroup#">
<cfcase value="1">
<cfinclude template="protectedgrouppa
</cfcase>
<cfcase value="2">
<cfinclude template="protectedgrouppa
</cfcase>
... more cfcase as neccesary ..
<cfdefaultcase>
place an error like "there is no such user group"
</cfdefaultcase>
</cfswitch>
--------------------------
logprocess.cfm
------------------
<cfquery datasource="real" name="x">
SELECT *
FROM users
WHERE (trim(users.username)='#tr
AND (trim(users.password)='#tr
</cfquery>
<CFIF x.RecordCount GT 0>
<CFSET Session.loggedIn=True>
<CFLOCATION url="../secure2/index.cfm"
<CFELSE>
<CFLOCATION url="badlogin.cfm">
</CFIF>
Application.cfm
-------------
<CFAPPLICATION NAME="x" sessionmanagement="YES" clientmanagement="NO" setclientcookies="YES" SESSIONTIMEOUT="#CreateTim
<CFPARAM NAME="Session.loggedIn" DEFAULT="False">
<CFIF ((Session.loggedIn IS "False") AND (NOT (FindNoCase("logprocess", "#CGI.SCRIPT_NAME#"))))>
<CFLOCATION url="login.cfm" addtoken="no">
</cfif>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tried my page today but it doesnt seem to work. Firefox keeps giving me the messsage:
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
* This problem can sometimes be caused by disabling or refusing to accept
cookies.
Why is this happening?
I think it might have something to do with the directory structure?
These three files are in /secure
--- login.cfm
<cfform
name="x"
method="post"
action="logprocess.cfm">
<tr>
<td height="0" width="225" class="text" align="center">Username</t
<td height="0" width="224" >
<cfinput name="username" type="text" maxlength="10" maxchars="10" /></td>
</tr>
<tr>
<td height="0" class="text" align="center" >Password</td>
<td height="0" width="224" ><cfinput name="password" type="password" maxlength="10" maxchars="7"/></td>
logprocess.cfm---
<cfquery datasource="real" name="x">
SELECT *
FROM users
WHERE (trim(users.username)='#tr
AND (trim(users.password)='#tr
</cfquery>
<CFIF x.RecordCount GT 0>
<CFSET Session.loggedIn=True>
<CFLOCATION url="../secure2/index.cfm"
<CFELSE>
Bad Login<br>
Click <a href="login.cfm">Here</a> to try again. New users please <a href="register.cfm">regist
</CFIF>
Application.cfm----
<CFAPPLICATION NAME="x" sessionmanagement="YES" setclientcookies="yes" clientmanagement="NO" SESSIONTIMEOUT="#CreateTim
<CFPARAM NAME="Session.loggedIn" DEFAULT="False">
<CFIF ((Session.loggedIn IS "False") AND (NOT (FindNoCase("logprocess", "#CGI.SCRIPT_NAME#"))))>
<CFLOCATION url="login.cfm" addtoken="no">
</cfif>