We help IT Professionals succeed at work.

how to login with different type of users ?

mmccy
mmccy asked
on
Medium Priority
154 Views
Last Modified: 2013-12-24
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
Comment
Watch Question

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>
Commented:
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.