Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question PHP and SQL login redirects

    Hello,

    I used this tutorial: http://www.adesdesign.net/php/tutori...cure_login.php

    to create a simple login page that redirects fine and is connected to my sql database. however I would like to make it so that I can have 2 different user name and passwords (easy enough up until here) that each redirect to different pages. Is there a tutorial or perhaps some help anyone here can offer me to make this happen? thank you so much any help is greatly appreciated.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    To make it flexible you'll want to add a column to your user table that indicates the type of user, and then add code in the login script to read that column and redirect as you like.

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks that makes a lot of sense actually. The only problem is I am almost a total newbie with this type of stuff.

    so to start with the sql portion of adding in a new column. I clicked add new field and named it "usrtype" however I did not know what option to use from the type drop down menu. is it VARCHAR like username and password is? and what about length/values?

    I am not sure how I am going to add in the php code after but I guess I'll deal with this first.

  • #4
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    It's your preference, really. Some people like using integers for that kind of stuff... but then you need the legend to know what each number means. (What's does a "6" mean again? bleh) I've seen shop standards use integers, 4-character fields, 8-character fields, 1-character fields...

    I personally use enough characters to make the code meaningful. This is usually 4 to 8. For your needs you'd probably do fine with a 4-character column.. "ADMN", "USER", "MOD", are all descriptive enough to me.

    And yes, once this is done you're going to have to actually dive into the code, and it's Dreamweaver-generated code too! Good luck with that.

  • #5
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok so I have the sql setup perfectly I believe. So now time to dive into the code as you say.

    Dreamweaver actually gives the option to restrict access based on username, password and access level. it then lets me choose my "usrtype" column from my sql server to verify the level. what it is missing however is an option that enables me to select which "access level" redirects to which page. and tips on how I can code that in?

  • #6
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Anyone have any advice at all to help get me kick started on writing the php for this?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •