Results 1 to 4 of 4

Thread: Setting up admin levels

  1. #1
    Join Date
    Aug 2008
    Location
    Smiths, AL
    Posts
    164
    Thanks
    30
    Thanked 5 Times in 5 Posts

    Default Setting up admin levels

    I have set up usernames and passwords using php/mysql but no I want to create 4 different levels from site owner with full control to site admin with majority control and users 1 and 2, 2 being the lowest user account.

    How would I go about doing this?

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    I'd suggest having a field in the user mysql db such as "position."
    Code:
    1	User
    2	Moderator
    3	Admin
    4	Root Admin
    Then user would have few permissions such as the normal ones and moderators would have moderator permissions and so on..

    If you've got any questions how to code it I'd be glad to help.
    Jeremy | jfein.net

  3. #3
    Join Date
    Aug 2008
    Location
    Smiths, AL
    Posts
    164
    Thanks
    30
    Thanked 5 Times in 5 Posts

    Default

    Yes I would like help on coding it into the site. I just set up the permissions in MySQL as "positions" and assigned them a a number.

    Now what?

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Now do something like this:
    Code:
    $query = "SELECT * FROM `table` WHERE `user_id`='{$_GET['id']}'";
    $result = mysql_query($query);
    while($row = mysql_fetch_assoc($result)){
      $queryA = "SELECT * FROM `table` WHERE `position`='{$row[\'position\']}'";
      $resultA = mysql_query($query);
      while($rowA = mysql_fetch_assoc($resultA)){
        if($rowA['positions'] == $row['positions']){
          echo "Your position # is ".$rowA['positions'];
        }
      }
    }
    To something like that.
    Jeremy | jfein.net

Bookmarks

Posting Permissions

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