// Session as read-only to not lock the file. session_start(); session_write_close(); $userID = $_SESSION['userID']; require('../includes/maps.php'); require('../includes/mapclass.php'); require('../includes/datas.php'); if ($_GET['getmap'] == 'true') { $mapID = $_GET['mapID']; $code = getMapCode($mapID); $map = GenerateMapByCode($code); echo displaymap($map, $mapID); } if ($_GET['getscores'] == 'true') { } if ($_GET['getmaplist'] == 'true') { $daysAgo = $_GET['daysago']; //echo "$daysAgo"; $todaysScoreMaps = getMapsPlayed($daysAgo); echo getMapNavigation($todaysScoreMaps); } function getMapsPlayed($daysAgo) { $sql = " SELECT `mapID`, `code`, `mapType` FROM `mapOfTheDay` INNER JOIN `maps` ON `mapID` = maps.ID WHERE DATE_ADD(CURDATE(), INTERVAL -$daysAgo DAY) = mapDate AND `mapType` IN (1, 2, 3, 4) "; $result = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($result) == 0) return -1; global $mapNamesByType; $r = array(); while($data = mysql_fetch_array($result)) { $code = $data['code']; $mapID = $data['mapID']; $mapType = $data['mapType']; $map = new map($code); if ($map->name == '') $map->name = $mapNamesByType[$mapType]; $r[$mapID] = $map; } return $r; } function getMapNavigation(&$maps) { foreach ($maps as $mapID => &$map) { $r .= "