I found some code by Natch over
there and adjusted a bit.
PHP Code:
if ($_GET['popular'] == "true")
{
define('POPULAR', 'true');
// Select most played
$result_allgames = $DB_site->query("
SELECT *, " . TABLE_PREFIX . "games.gameid AS gameid, " . TABLE_PREFIX . "games.title AS title, " .
TABLE_PREFIX . "games.gamesettings as gamesettings, COUNT(" . TABLE_PREFIX . "gamesessions.gamename) AS popularity
FROM " . TABLE_PREFIX . "games
INNER JOIN " . TABLE_PREFIX . "gamesessions
ON " . TABLE_PREFIX . "games.shortname = " . TABLE_PREFIX . "gamesessions.gamename
WHERE gamesessions.valid = 1
GROUP BY title
ORDER BY popularity DESC
LIMIT 10
");
$navbits = array("arcade.php?$session[sessionurl]" => "Arcade");
$navbits[""] = "Most Popular Games";
} else {
//and of course not to for get the closing
}
//before
$gamecount = $DB_site->num_rows($result_allgames);