Re: newbie: help with array
| From: | patlebon | Date: | Mon, 28 Apr 2003 13:14:30 +0000 |
| Subject: | Re: newbie: help with array | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145522@lists.php.net to get a copy of this message | ||
The check permission only works when the permission is in the array. When
the array does not contain the required permission the following error is
thrown:
Notice: Undefined offset: 3 in C:\Inetpub\...\menu.php on line 29
Any ideas what may be casuing this? Thanks for your help so far.
"Marek Kilimajer" <kilimajer@webglobe.sk> wrote in message
news:3EAD0B3E.9050901@webglobe.sk...
> Something like:
> // set permissions
> while($perm = mysql_fetch_assoc($res)){
> $_SESSION['userPermissions'][$perm['userPermission']]=1;
> }
>
> //check permission
> if($_SESSION['userPermissions']['read']) {
> //is allowed to read
> }
>
> patlebon wrote:
>
> >I have database table that contains userId and permissionId. I want to
query
> >this table and make an array/list of permissions for a user when they
login
> >and assign these to a session variable called
$_SESSION["userPermissions"].
> >On other pages i want to check if their $_SESSION["userPermissions"]
array
> >contains certain permissions and only allow certian bits of code to be
> >displayed if it does.
> >
> >I have the query to get the permissions from the database but after this
im
> >not sure what to do.
> >
> >Any help on how to do this would be much appreciated.
> >
> >
> >
> >
> >
>