[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 142
  • Last Modified:

how to login with different type of users ?

I have a table in sql server that contain username , usertype, password
how to making different login type and redirect to different pages ??
any suggestions  ?? any sample code ?? please !!

thx thx !!
Mike
0
mmccy
Asked:
mmccy
1 Solution
 
javasharpCommented:
Create an intermediate file to redirect to appropriate file based on the user type. like,

<cfif #GetUserDetails.usertype# eq 'Admin'>
  <cflocation url="admin_user_page.cfm">
<cfelse>
  <cflocation url="general_user_page.cfm">
</cfif>
0
 
PluckaCommented:
mmccy,

<cfquery name="getUser">
    select  *
    from    UserTable
    where   UserName = '#form.UserName#'
</cfquery>

<cfswitch expression="#getUser.UserType#">
    <cfcase value="Admin">
        <cflocation url="AdminPage.cfm" />
    </cfcase>
    <cfcase value="Normal">
        <cflocation url="NormalPage.cfm" />
    </cfcase>
    <cfdefaultcase>
        <cflocation url="Logout.cfm" />
    </cfdefaultcase>
</cfswitch>

If several types go to the one page, you can use a comma seperated list. This is much cleaner than if elseif constructs.
<cfcase value="Normal,Admin">

Regards
Plucka
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now