12-28-12. I plan on making considerable changes to this page in the near future.
Thank you for your patience!
Showing scores for the maps played on echo $dateAsStr; ?>
if ($daysAgo > 1) {
echo "
Current Day";
echo "
Next Day";
}
echo "
Previous Day";
$time_start = microtime(true);
$statContent .= displayPastMaze(1, 'Simple', $daysAgo);
$statContent .= displayPastMaze(2, 'Normal', $daysAgo);
$statContent .= displayPastMaze(3, 'Complex', $daysAgo);
$statContent .= displayPastMaze(4, 'Special', $daysAgo);
$time_end = microtime(true);
$time = $time_end - $time_start;
if ($_GET['debug'] == true) echo "StatContent Rechieve: $time seconds\n";
$special = 'Special';
if ($specialMapName != '')
$special = $specialMapName;
?>
echo $statContent;
function displayPastMaze($mapType, $name, $daysAgo = 1) {
//Ensure no cheating
if ($daysAgo < 1)
return;
$pastMap = pastMap($mapType, $daysAgo);
$mapID = $pastMap;
$mapcode = getMapCode($mapID);
$map = GenerateMapByCode($mapcode);
$sql = "SELECT
maps.ID as mapID,
solution,
users.displayName as Name,
SUM(solutions.moves) as Moves,
timediff(solutions.dateModified, maps.dateCreated) as Timetaken,
users.wallColor,
users.wallEmblem,
users.displayColor,
users.ID as userID,
solutions.championPointsWorth
FROM `maps`
JOIN `solutions`
ON maps.ID = solutions.mapID
JOIN `users`
ON solutions.userID = users.ID
JOIN `mapOfTheDay`
ON maps.ID = mapOfTheDay.mapID
WHERE
maps.ID = '$mapID'
GROUP BY solutions.userID
ORDER BY Moves DESC, `dateModified` ASC
";
$result = mysql_query($sql) or die(mysql_error());
$statname = "Yesterday's Best $name:";
if ($daysAgo > 1) {
$statname = "$daysAgo days ago's Best $name:";
}
$stats = displayStats($result, $statname);
//Sucky temporary solution:
$GLOBALS['specialMapName'] = $map[0][6];
$sql = "SELECT `moves`, `displayName`, `solution`
FROM `solutions`
LEFT JOIN `users`
ON solutions.userID = users.ID
WHERE `mapID` = '$mapID'
ORDER BY `moves` DESC, `dateModified` ASC
LIMIT 1";
$result = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
list($bestMoves, $byName, $solution) = mysql_fetch_row($result);
}
$r = '';
$r .= '
';
$r .= "
";
$r .= '
';
$r .= $stats;
$r .= '
';
$r .= '
';
$r .= "Best solution for this map: $bestMoves by $byName ";
$r .= DisplayMap($map, $mapID, 'normal', 2);
$r .= '
';
$r .= '
';
return $r;
}
function displaystats($result, $caption = NULL) {
//Get names.
$headers = "