Need to exclude dynamic menu choices based upon privledge level
Looking for a quick little bit of guidance.
Each of the administrative pages on my site have access that is limited by an access level assigned to each user. Problem is, when adding or editing a user, one could add a user with more priviledges than they have. Therefore, I would like to be able to limit the priviledges within the following code for a dynamic menu.
I am sure this is simple, I just cannot wrap myself around it right now.
<?php
do {
?><option value="<?php echo $row_rsUserType['AccessLevel']?>"
<?php if (!(strcmp($row_rsUserType['AccessLevel'], $row_rsUserType['AccessLevel']))) {echo "selected=\"selected\"";} ?>>
<?php echo $row_rsUserType['UserType']?></option>
<?php
} while ($row_rsUserType = mysql_fetch_assoc($rsUserType));
$rows = mysql_num_rows($rsUserType);
if($rows > 0) {
mysql_data_seek($rsUserType, 0);
$row_rsUserType = mysql_fetch_assoc($rsUserType);
}
?>
Record set is defined as follows:
<?php
//connect to the database and define the recordsets for the dynamic drop down box
mysql_select_db($database_connMI, $connMI); //establish connection to database
//user recordset
$query_rsUser = "SELECT UserID, Username, usertype.UserType FROM `user`, usertype WHERE `user`.AccessLevel = usertype.AccessLevel ORDER BY `user`.AccessLevel ASC";
$rsUser = mysql_query($query_rsUser, $connMI) or die ('<p>Could not select the database because <b>' .mysql_error().'</b></p>');
$row_rsUser = mysql_fetch_assoc($rsUser);
$totalRows_rsUser = mysql_num_rows($rsUser);
//usertype recordset
$query_rsUserType = "SELECT UserType, AccessLevel FROM usertype";
$rsUserType = mysql_query($query_rsUserType, $connMI) or die ('<p>Could not select the database because <b>' .mysql_error().'</b></p>');
$row_rsUserType = mysql_fetch_assoc($rsUserType);
$totalRows_rsUserType = mysql_num_rows($rsUserType);
?>