<?php defined( '_BIGNIGHT_EXEC' ) or die( 'Restricted access' );?>

<a href="index.php"><div id="logo"></div></a>

<div id="menu"><ul>
<?php	
	$rows = $DB->qry("SELECT * FROM menu ORDER BY id;");
	while($row = mysql_fetch_assoc($rows)){
		echo "<li class=\"menu_item\"><a " . ($_GET["view"]==$row["view"] ? "class=\"menu_highlight\" " : "") . "href=\"index.php" . ($row["view"]===NULL ? "" : "?view=" . $row["view"]) . "\">" . $row["item"] . "</a></li>";
	}
	if (isset($user) && $user["permissions"]>=2) 
		echo "<li class=\"menu_item\"><a href=\"admin/index.php\"><font color=\"#FF9900\">admin</font></a></li>";
?>
</ul></div>

<div id="login">
<?php if (!isset($user)): ?>
	<form name="login" method="post" action="index.php">
		Username: <input type="text" size="15" name="username"><br>
		Password: <input type="password" size="15" name="password"><br>
		Remember Me: <input type="checkbox" name="rememberme" value="1"><br>
		<input type="submit" name="login-submit" value="Log in">
	</form>
	<a href="index.php?view=user">Register</a><br>
	<a href="index.php?view=forgot">Forgot Password</a>
<?php else: ?>
	<a href="index.php?view=user">Welcome, <?php echo $user["username"]; ?></a>
	<form name="logout" method="post" action="index.php">
		<input type="submit" name="logout-submit" value="Log out">
	</form>
<?php endif; ?>
</div>

