I am trying to get a menu system to only put in an admin section when I (as opposed to anyone else) log in.
This is what I have so far:
<?php include("validate.php"); ?>
<?php include("obfuscate.php"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Rupstar.com - My own social network.</title>
<meta name="resource-type" content="document">
<meta name="description" content="">
<meta name="keywords" content="">
<link rel=stylesheet type="text/css" href="main.css">
<script language="JavaScript" type="text/javascript" src="nav.js"></script>
</head>
<body onLoad="init();" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#ffffff">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td background="graffiti.jpg"><a href="v4.php"><img src="invis.gif" width="438" height="196" border="0" alt="Rupstar.com - My own social network"></a></td>
</tr>
</table>
<table border="0" cellpadding="10" width="150" cellspacing="0">
<tr>
<td> </td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer1'); stopTime()" onMouseOut="startTime();">PROFILE</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer2'); stopTime()" onMouseOut="startTime();">FORUM</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer3'); stopTime()" onMouseOut="startTime();">PHOTOS</a></td>
<td><a href="#" onMouseOver="hideAll(); showLayer('layer4'); stopTime()" onMouseOut="startTime();">FRIENDS</a></td>
<?php // if( $username=="rupertbj" ) { print "<td><a href=\"admin.php\">ADMIN</a></td>"; } ?>
<?php if( $username=="rupertbj" ) { print "<td><a href=\"#\" onMouseOver=\"hideAll(); showLayer('layer5'); stopTime()\" onMouseOut=\"startTime();\">ADMIN</a></td>"; } ?>
<td><a href="index.php">LOGOUT</a></td>
</tr>
</table>
<div id="layer1">
<a href="/myProfile.php" onMouseOver="stopTime();" onMouseOut="startTime();"> My Profile</a><br>
<a href="/userModify.php" onMouseOver="stopTime();" onMouseOut="startTime();"> Update Profile</a><br>
<a href="/passModify.php" onMouseOver="stopTime();" onMouseOut="startTime();"> Update Password</a><br>
</div>
<div id="layer2">
<a href="/forum.php" onMouseOver="stopTime();" onMouseOut="startTime();"> Forum</a><br>
</div>
<div id="layer3">
<a href="/photos.php" onMouseOver="stopTime();" onMouseOut="startTime();"> Photo Albums</a><br>
<a href="/moblog.php" onMouseOver="stopTime();" onMouseOut="startTime();"> MoBlog</a><br>
</div>
<div id="layer4">
<a href="/members.php" onMouseOver="stopTime();" onMouseOut="startTime();"> All Friends</a><br>
</div>
<?php if( $username=="rupertbj" ) { print"
<div id=\"layer5\">
<a href=\"/admin.php\" onMouseOver='stopTime();' onMouseOut='startTime();'> Update Homepage</a><br>
<a href=\"/listusers.php\" onMouseOver='stopTime();' onMouseOut='startTime();'> List Users</a><br>
<a href=\"/mailinglist.php\" onMouseOver='stopTime();' onMouseOut='startTime();'> Mailing List</a><br>
<a href=\"/inviteNew.php\" onMouseOver='stopTime();' onMouseOut='startTime();'> Add New User</a><br>
</div>";
}
?>
All works fine, except that the menu items in the admin never disappear once it has been moused-over.
Any ideas?
Many thanks.
Rupert