phpBB3 Rank Variable

Discussion in 'PHP' started by X.Homer.X, Nov 2, 2007.

  1. #1
    Okay, so i have a user system that runs off of the phpBB3 user database on my site. i can call the rank variable (their rank on the site) with...
    
    <?php
    if($user->data['user_rank'] == "1") //rank 1 =Admin
    {
    echo 'Go To Admin panel!';
    }
    ?>
    
    Code (markup):
    But i want to have it so that rank 1,2,3 and 5 can access it. could i do it like this?

    
    <?php
    if($user->data['user_rank'] == "1" || "2" || "3" || "5")
    {
    echo 'Go To Admin panel!';
    }
    ?>
    
    Code (markup):
    any help is greatly appreciated.
     
    X.Homer.X, Nov 2, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    nico_swd, Nov 2, 2007 IP
  3. X.Homer.X

    X.Homer.X Peon

    Messages:
    290
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    
    <?php
    $rank = $user->data['user_rank'] ;
    if(in_array ("1", $rank)) {
    echo 'Go To Admin panel!';
    }
    ?>
    
    Code (markup):
    would that make sense? or do i have to do something else?
     
    X.Homer.X, Nov 2, 2007 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    
    if (in_array($user->data['user_rank'], array(1, 2, 3, 5)))
    {
        echo 'Go To Admin panel!';
    }
    
    PHP:
     
    nico_swd, Nov 2, 2007 IP