$startDate) { $endDate = (int)$_REQUEST['endDate']; } function printResultSet($res) { global $psdb; echo '[{"label": "Pokémon Showdown", "data": ['; $row = $psdb->fetch_assoc($res); $po = false; $last = 0; while (true) { $value = (int)($row['date'] / 1000); $delta = $value - $last; $last = $value; echo '[' . $delta . ',' . $row['usercount'] . ']'; if ($row = $psdb->fetch_assoc($res)) { if (!$po && ($row['programid'] !== 'showdown')) { echo ']}, {"label": "Pokémon Online (src)", "data": ['; $last = 0; $po = true; } else { echo ','; } } else { break; } } echo ']}]'; } function printRecentResults() { global $psdb; $res = $psdb->query( "SELECT `date`, `usercount`, `programid` " . "FROM `ntbb_userstatshistory` " . "WHERE (`date` > (UNIX_TIMESTAMP() - 60*60*24*3) * 1000) " . "ORDER BY `programid` ASC, `date` ASC"); printResultSet($res); } function printJsonResults($startDate, $endDate) { global $psdb; $maxResults = 1000; // This should be approximately // ((date of last stat) - (date of first stat)) / $maxResults $intervalLimit = 1000 * 60 * 60; $interval = (int)(($endDate - $startDate) / $maxResults); if ($interval > $intervalLimit) { $interval = $intervalLimit; } $res = $psdb->query( "SELECT `date`, `usercount`, `programid` " . "FROM `ntbb_userstatshistory` " . "WHERE `date` BETWEEN " . (int)$startDate . " AND " . (int)$endDate . " " . "GROUP BY FLOOR(`date`/" . $interval . "), `programid` " . "ORDER BY `programid` ASC, `date` ASC" ); printResultSet($res); } if (isset($_REQUEST['format']) && ($_REQUEST['format'] === 'json')) { header('Content-Type: application/json'); printJsonResults($startDate, $endDate); exit(); } $res = $psdb->query( 'SELECT `date`, `usercount` ' . 'FROM `ntbb_userstatshistory` ' . 'WHERE `programid`=\'showdown\' ' . 'ORDER BY `usercount` DESC ' . 'LIMIT 1'); $maxUsers = null; if ($res) { $maxUsers = $psdb->fetch_assoc($res); } $page = 'userstats'; $pageTitle = "User stats"; includeHeaderTop(); ?>
Loading...

This graph shows the number of users on the official server. By default, the last 3 days are shown. The most users ever recorded online at once was users on . Times are displayed as UTC, which is probably your local timezone.

Click and drag a section of the overview below to view an arbitrary time period: