<div class="navh3">login</div>
<?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 '<img id="avatarimage" src="'.$avatarimage.'" height="100" width="100" align="left">';                    

	echo "<br/>Games played: <b>".$row['plays']."</b>";
	?>
	<br/><br/>
	<?php
	if ($setting['seo']=='yes') {
		?>
		<a href="<?php echo ''. $setting['siteurl'] .'profile.html';?>" title="<?php echo ''. $user .'';?>'s-Profile">Edit Profile</a><br/>
		<a href="<?php echo ''. $setting['siteurl'] .'editavatar.html';?>" title="Edit Avatar">Edit Avatar</a><br/>
		<a href="<?php echo ''. $setting['siteurl'] .'favourites.html';?>" title="Favourtie Games">Favorite Games</a><br/>
		<a href="<?php echo ''. $setting['siteurl'] .'logout.php';?>" title="Logout">Logout</a>
		<?php
	} else {
		?>
		<a href="<?php echo ''. $setting['siteurl'] .'index.php?act=profile';?>" title="Edit Profile">Edit Profile</a><br/>
		<a href="<?php echo ''. $setting['siteurl'] .'index.php?act=editavatar';?>" title="Edit Avatar">Edit Avatar</a><br/>
		<a href="<?php echo ''. $setting['siteurl'] .'index.php?act=favourites';?>" title="Favourtie Games">Favorite Games</a><br/>
		<a href="<?php echo ''. $setting['siteurl'] .'logout.php';?>" title="Logout">Logout</a>
		<?php
	} 
} else {	
	?>
	<form name="myform" action="<?php echo $setting['siteurl'];?>login.php" method="post">
		Username: <input type="text" name="username" size="15" /><br />
		Password: &nbsp;<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>
	<a href="<?php echo $setting['siteurl'];?>index.php?act=register">Register</a><br>
	<a href="<?php echo $setting['siteurl'];?>index.php?act=forgotpassword">Forgot Password</a>
	<?php
} ?>                     