<?php require_once("functions.php");
error_reporting(E_ALL ^ E_NOTICE);
?>
<div id="sidebar">
<ul>
<li class="home"><a href="index.php">Home</a></li>
<li class="archives">Archives
<ul>
<li>January</li>
<li>Febuary</li>
<li>March</li>
</ul>
</li>
</ul>
<!--if not logged in, show login and register links-->
<?php if (!loggedin()) { ?>
<ul>
<li><a href='login.php'>Login</a></li>
<li><a href='register.php'>Register</a></li>
</ul>
<?php
} //if is logged in and username matches cookie
else {
$name = $_COOKIE["BlogName"];
if (isset($_COOKIE["BlogName"]) && (checkname($name))) { ?>
<strong> Welcome <?php echo $name?>!</strong><br />
<a href="add_entry.php">Add an Entry</a><br />
<a href='logout.php'>Logout</a> <?php }
// if there is a mismatch between cookie and db info, instruction to logout and log back in
else { ?> There is a<br /> problem with<br /> your cookies.<br /> <a href='logout.php'>Logout</a> and log<br /> back in.
<?php;}
}
?>
</div>