Login with user group

Discussion in 'PHP' started by badmasketa, Oct 7, 2008.

  1. #1
    i have a table called users

    CREATE TABLE `users` ( `id` int(11) NOT NULL auto_increment, `username` varchar(65) NOT NULL default '', `password` varchar(65) NOT NULL default '', `group` int(4) NOT NULL default '0', `email` varchar(200) default NULL, PRIMARY KEY (`id`) ) TYPE=MyISAM ROW_FORMAT=DYNAMIC COMMENT='© badmas'


    now what i want is a database login script and when create session or cookie for user group...

    if user=0 then show user features, if user=1 then show admin features....

    is this possible??
     
    badmasketa, Oct 7, 2008 IP
  2. bennjoe

    bennjoe Peon

    Messages:
    134
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Of course.
    I'd suggest you use the conditional to display the features via the navigation based on user status

    here's the logic:

    If (user_status=='1')
    {
    show_admin_features
    }
    else
    {
    show_basic_features
    }
     
    bennjoe, Oct 7, 2008 IP
  3. joxtechnology

    joxtechnology Peon

    Messages:
    146
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    just add a condition for every user group features you needed
     
    joxtechnology, Oct 7, 2008 IP
  4. techcone

    techcone Banned

    Messages:
    206
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    First verify the user and pass against the database.

    If they are verified , then set the cookie and one more cooike to show the user group using if statement.

    Also on all pages ,always match all three cookie value or else by simple javascript injection, I can gain admin privileges . :)

    PM me if u want further help.

    Thanks and Regards.
     
    techcone, Oct 7, 2008 IP
  5. badmasketa

    badmasketa Well-Known Member

    Messages:
    351
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #5

    thats exactly wat i was looking for, but could you please post the code or PM me?
     
    badmasketa, Oct 7, 2008 IP