Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3484840
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:50:08+00:00 2026-05-18T10:50:08+00:00

I know vBulletin uses bitperms, I was using them too but when I got

  • 0

I know vBulletin uses bitperms, I was using them too but when I got to 10^63 they stopped working, it wouldn’t handle any numbers greater than that (it being my PHP host).

I’m curious to know what myBB, PhpBB, IPB, Joomla and other scripts on the net use for permission systems, I really want to use a fast permission setup in my script. Right now I’ve implemented a sql variable on each user called permgroups and would have a value such as 1,4,5 and each of those numbers correspond to a permission group which has a similar variable called canseepages 1,2,3,4,1,4,1,54,6,4,5,22,6,2,3,4,1,2 which correspond to each page I have.

First I select permgroups in PHP

Then I use PHP’s explode on permgroups

then I do a foreach on every perm group the user can see

within the foreach I run a sql query to grab the canseepages variable from the permissions group

I then append this to a variable so I end up with something MASSIVE like

$variable = '1,2,3,4,5,6,7,8,9,2,22,55,44,55,33,44,11,44,33,44,11,33,44,'.
'22,33,44,11,22,33,44,33,11,22,33,44,33,22,33,44,55,44,'.
'55,54,26,77,84,645,345,233,11,4,11,3,32';

That variable represents all the pages the user is allowed to view. I then explode that into an array of numbers and I use in_array() to check if the current page they’re trying to view is within that array of pages they’re allowed to view.

It’s pretty fast now but I’m just thinking there must be a faster method of doing all this in general.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T10:50:08+00:00Added an answer on May 18, 2026 at 10:50 am

    I figured out a long time back that Bit masks was the best possible solution for User Permissions:

    Short Example:

    class UserPermissions()
    {
        private $Mask = 0;
    
        //Levels
        const PUBLIC_READ = 1;
        const PUBLIC_WRITE = 2;
        const PUBLIC_EDIT = 4
        const PUBLIC_DELETE = 8;
        //ETC
    
        public function __construct($Mask)
        {
            $this->Mask = $Mask;
        }
    
        public function InvokePermission($Bit)
        {
            return ($Mask & $Bit); //True / False
        }
    
        public function AddPermission($Bit)
        {
            $this->Mask |= $Bit; //Add the bit to the mask
        }
    
        public function RevokePermission()
        {
            $this->Mask &= ~ $Bit;
        }
    
        public GetMask()
        {
             return $this->Mask;
        }
    }
    

    Simple use like so:

    $Permissions = new UserPermissions($User->PermissionsData);
    
    if($Permissions->InvokePermission( Permissions:: PUBLIC_EDIT ))
    {
        //Use can edit
    }
    

    Some links:

    • Why should I use bitwise/bitmask in PHP?
    • Duplicate (From Myself)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, so we are using vBulletin..ya I know. Which is within our Kohana based
I know very little about Agile but I wonder if there is any difference
I know there are similar questions already on SO but none of them seem
i'm using Nivo Slider in my Wordpress and vBulletin with a Iframe . but
You know how vBulletin has a sql profiler when in debug mode? How would
Know this might be rather basic, but I been trying to figure out how
Know if it's possible to access the iPhone compass in Safari using JavaScript? I
I know you can not set a key value dynamically, but what about the
I know that Phonegap has an event for back button, but it's only available
I know that this sort of question has been asked here before, but still

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.