Advertisement
rainbowdash28

Right-System

Jun 6th, 2012
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. function get_right($required, $rights = 'nothing') {
  2.     $rechte = array();
  3.     global $global_count;
  4.     global $global_rights;
  5.     global $global_needed;
  6.    
  7.    
  8.     if($rights == 'nothing') $right = $global_rights[get_user_class()];
  9.     if($rights != 'nothing') $right = $global_rights[$rights];
  10.    
  11.     for($i = $global_count[0]; $i >= 0; $i--) {
  12.         $wert = pow(2, $i);
  13.       if($right['rights'] >= $wert) {
  14.         $rechte[] = $wert;
  15.         $right['rights'] -= $wert;
  16.     }
  17.     }
  18.   if(in_array($global_needed[$required]['flag'], $rechte)) {
  19.     return true;
  20.   } else {
  21.     return false;
  22.   }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement