If you have a database this solution is much more robust and can be maintained through the admin area even allowing different levels of administration.
CREATE TABLE IF NOT EXISTS users (
ID BIGINT NOT NULL auto_increment,
UserName VARCHAR(20) NOT NULL,
Password VARCHAR(20) NOT NULL,
AccessLevel TINYINY NOT NULL,
PRIMARY KEY (ID),
UNIQUE UserName (UserName),
INDEX Password (Password),
INDEX AccessLevel (AccessLevel)
)
CREATE TABLE IF NOT EXISTS menu (
ID BIGINT NOT NULL auto_increment,
MenuText VARCHAR(50) NOT NULL,
URL VARCHAR(100) NOT NULL,
AccessLevel TINYINT NOT NULL,
DispOrder INT NOT NULL,
PRIMARY KEY (ID),
UNIQUE MenuText (MenuText),
INDEX AccessLevel (AccessLevel),
INDEX DispOrder (DispOrder)
)
then you do this in php
<?php
//assumption, the person's accesslevel has been set in
//the $al variable
$sql = "SELECT MenuText,URL \n";
$sql .= "FROM menu \n";
$sql .= "WHERE AccessLevel <= $al \n";
$sql .= "ORDER BY DispOrder";
$menuOptions = @mysql_query($sql);
while($link = mysql_fetch_assoc($menuOptions)) {
echo "<a href=\"" . $link['URL'] . "\">";
echo $link['MenuText'] . "</a><br />\n";
}
?>
This will generate the menu on the fly for each user based on their access level. Each user will see all the menu option at or below their access level.