permissions
| From: | magnus | Date: | Mon, 27 Nov 2000 21:14:16 +0000 |
| Subject: | permissions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-27443@lists.php.net to get a copy of this message | ||
Hello,
I'm trying to figure out a way to check for a user's database
permissions (read, write).
I've got my sql result as a single array - R W - (it's one column in the
db).
I want to check each array char , but I can't seem to get at the array
contents.
I'm very stuck. Hope the following is senseful...
Thanks,
Magnus Lawrie
if (isset($sess_usr[2])) // if true then get permissions
{
$sql="SELECT rule FROM usr_tbl_ruls WHERE
cftab_id=$fid AND usrgrp_id=$sess_usr[1]";
echo "$sql<br>";
$result=pg_exec($conn, $sql)
or die ("failed to execute sql rules query");
$num = pg_numrows($result);
for ($i=0; $i<$num; $i++)
{
$r = pg_fetch_row($result, $i);
for ($j=0; $j<count($r); $j++)
{
echo "$r[$j] ";
if ($r[$j] = R)
{ $read = true;
echo $read;
}
else { $read = false;
echo $read;
}
if ($r[$j] = W)
{
$write = true;
echo $write;
}
else { $write = false;
echo $write;
}
}