<div class="nav_box"><div class="nav">Login</div>
<div class="nav_box2">
<?php
if(isset($_SESSION["user"])) {
	$user=$_SESSION["user"];
	$query = yasDB_select("select `useavatar`, `avatarfile`, `plays` from `user` where `username` = '$user'");
	$row = $query->fetch_array(MYSQLI_ASSOC);
	if ( $row['useavatar'] == '1' ) {
	$avatarimage = $setting['siteurl'] . 'avatars/' . $row['avatarfile'];
	} else {
	$avatarimage = $setting['siteurl'] . 'avatars/useruploads/noavatar.JPG';
	}
	echo "<h2>Welcome <b>".$user."</b></h2><br/>";
	echo '<center><img id="avatarimage" src="'.$avatarimage.'" height="100" width="100" align="top"/>
	</center><br/>';
	echo "<center><h2>Games played:</h2>
	<b>".$row['plays']."</b></center>";
		if ($setting['seo']=='yes') {
		?>
		<div class="links1">
		<a href="<?php echo ''. $setting['siteurl'] .'profile.html';?>" title="<?php echo ''. $user .'';?>'s-Profile"><span><?php echo ''. $user .'';?>'s-Profile</span></a>
		<a href="<?php echo ''. $setting['siteurl'] .'editavatar.html';?>" title="Edit Avatar">Edit Avatar</a>
		<a href="<?php echo ''. $setting['siteurl'] .'favourites.html';?>" title="Favourtie Games">Favorite Games</a>
		<a href="<?php echo ''. $setting['siteurl'] .'logout.php';?>" title="Logout">Logout</a>
		</div>
		<?php
	} else {
		?>
		<div class="links1">
		<a href="<?php echo ''. $setting['siteurl'] .'index.php?act=profile';?>" title="Edit Profile">Edit Profile</a>
		<a href="<?php echo ''. $setting['siteurl'] .'index.php?act=editavatar';?>" title="Edit Avatar">Edit Avatar</a>
		<a href="<?php echo ''. $setting['siteurl'] .'index.php?act=favourites';?>" title="Favourtie Games">Favorite Games</a>
		<a href="<?php echo ''. $setting['siteurl'] .'logout.php';?>" title="Logout">Logout</a>
		</div>
		<?php
		} 
} else {
?>
	<form name="myform" action="<?php echo $setting['siteurl'];?>login.php" method="post">
	Username:<br /><input type="text" name="username" size="15" /><br />
	Password:<br /> <input type="password" name="password" size="15" /><br />
	Remember me: <input type="checkbox" name="remember" value="remember" ><br />
	<input type="submit" name="submit" value="Submit" />
	</form>
	<?php
	if ($setting['seo']=='yes') {
		echo '<br/><span class="links1"><a href="'. $setting['siteurl'] .'register.html">Register</a></span>';
		echo '<br/><span class="links1"><a href="'. $setting['siteurl'] .'forgotpassword.html">Forgot Password</a></span>';
	} else {
		echo '<br/><span class="links1"><a href="'. $setting['siteurl'] .'index.php?act=register">Register</a></span>';
		echo '<br/><span class="links1"><a href="'. $setting['siteurl'] .'index.php?act=forgotpassword">Forgot Password</a></span>';
	}
}
?>
<div class="clear"></div>
</div></div>