<?php

// Inialize session
session_start();
// Load config
include '../../../config.php';
// Get game title from id
$gameTitle = getGameTitleFromId($_GET['id']);
// Return info
echo $gameTitle;
function getGameTitleFromId($id)
{
    // Load game info
    $gameData = mysql_query("SELECT * FROM games");
    // Search for game id and return title
    while ($row = mysql_fetch_array($gameData)) {
        if ($row['id'] == $id) {
            return $row['name'];
        }
    }
}
    ?>
				<i class="icon-star"></i> <?php 
    echo getNumberAchievements();
    ?>
 achievements<br><br>
			<?php 
}
?>
		</div>
		<div class="span9">
			<div class="row">
				<h2>Recent activity</h2>
				<?php 
$userid = getUserIdFromName($username);
$session = mysql_query("SELECT * FROM sessions WHERE userid = '{$userid}'");
$row = mysql_fetch_array($session);
$gameid = $row['gameid'];
if (getGameTitleFromId($gameid) == "") {
    echo $username, " has no recent activity";
} else {
    echo $username, " was most recently seen playing <a href=\"viewgame.php?id=", $gameid, "\">", getGameTitleFromId($gameid), "</a>";
}
?>
			</div>
			<div class="row">
				<br><br><br><br><br>
				<center><h3>More profile data coming soon.</h3></center>
			</div>
		</div>
	</div>
</div>