[PHP] Bitwise operations criticism needed

2004-08-31 Thread Gerard Samuel
The situation. Im currently using a home brewed groups permission code in my site, but for limited users/groups its ok. Beyond that, the code will take the fast road to hell. I started to look in depth at bitwise operations today, and after much googling, and looking at other code, came up with

Re: [PHP] Bitwise operations criticism needed

2004-08-31 Thread Marek Kilimajer
Gerard Samuel wrote: The situation. Im currently using a home brewed groups permission code in my site, but for limited users/groups its ok. Beyond that, the code will take the fast road to hell. I started to look in depth at bitwise operations today, and after much googling, and looking at

Re: [PHP] Bitwise operations criticism needed

2004-08-31 Thread Gerard Samuel
Marek Kilimajer wrote: Gerard Samuel wrote: The situation. Im currently using a home brewed groups permission code in my site, but for limited users/groups its ok. Beyond that, the code will take the fast road to hell. I started to look in depth at bitwise operations today, and after much

Re: [PHP] Bitwise operations criticism needed

2004-08-31 Thread Marek Kilimajer
Gerard Samuel wrote: Marek Kilimajer wrote: Gerard Samuel wrote: The situation. Im currently using a home brewed groups permission code in my site, but for limited users/groups its ok. Beyond that, the code will take the fast road to hell. I started to look in depth at bitwise operations today,

Re: [PHP] Bitwise operations criticism needed

2004-08-31 Thread Gerard Samuel
Marek Kilimajer wrote: Your checks are something like if($user['tom'] $perm['read']) echo 'Tom can read'; Only the 3rd bit is checked, all others are ignored and won't do any harm. Anyway, the clean way of setting permissions is: $user['tom'] = $perm['execute'] | $perm['write'] | $perm['read'];