Vinnie
05-26-2001, 04:59 PM
I want to use this code in my phpinclude to determine if the user can control panel, and if so then create an additional icon in the fivelinks:
$getperms=$DB_site->query_first("
SELECT cancontrolpanel
FROM user,usergroup
WHERE user.usergroupid=usergroup.usergroupid
AND user.userid='$bbuserinfo[userid]'");
if ($getperms[cancontrolpanel]!=1) {
// does not have admin rights
} else {
// has admin rights
}
However, this causes extra access to the database! Right?
Are user permissions pre-loaded into any available variables (like $bbuser) or will this become inefficient? Especially considering that this is added to EVERY page...
Thoughts?
If this isn't the right forum for this question let me know - I figured this area was more appropriate for PHP coding specifics.
$getperms=$DB_site->query_first("
SELECT cancontrolpanel
FROM user,usergroup
WHERE user.usergroupid=usergroup.usergroupid
AND user.userid='$bbuserinfo[userid]'");
if ($getperms[cancontrolpanel]!=1) {
// does not have admin rights
} else {
// has admin rights
}
However, this causes extra access to the database! Right?
Are user permissions pre-loaded into any available variables (like $bbuser) or will this become inefficient? Especially considering that this is added to EVERY page...
Thoughts?
If this isn't the right forum for this question let me know - I figured this area was more appropriate for PHP coding specifics.