From fba0211254059e3fedfb32054c118026c5f2ed3e Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Mon, 12 Dec 2011 23:40:18 -0800 Subject: Admin page now shows memberlist. Sound volume reduced to 50%. Social networks added to about. Minor adjustments. --- pages/admin.php | 153 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 79 insertions(+), 74 deletions(-) (limited to 'pages/admin.php') diff --git a/pages/admin.php b/pages/admin.php index d825ebc..90060c2 100644 --- a/pages/admin.php +++ b/pages/admin.php @@ -10,84 +10,89 @@ include('./includes/maps.php'); include('./includes/mapoftheday.php'); include('./includes/db.inc.php'); -//$motd = MapOfTheDay(3); -//$mapID = $motd['id']; - -$pastMap = pastMap(3, 1); -$mapID = $pastMap; - -echo $mapID; - -//$mapID = '38'; -$mapcode = getMapCode($mapID); -$map = GenerateMapByCode($mapcode); - -$sql = "SELECT `moves`, `displayName`, `solution` - FROM `solutions`, `users` - WHERE `mapID` = '$mapID' AND - `userID` = users.ID - 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); - echo "
Best solution for this map: $bestMoves by $byName"; - - //$map = MergeMapSolution($motd['map'], $solution); - $map = MergeMapSolution($map, $solution); - echo DisplayMap($map, $mapID); - - echo "
"; - echo "
Is Current:"; - $is = isCurrentMap(77); - echo "
$is"; - $is = isCurrentMap(20); - echo "
$is"; - $is = isCurrentMap(76); - echo "
$is"; - $is = isCurrentMap(75); - echo "
$is"; - $is = isCurrentMap(74); - echo "
$is"; - echo "
"; - -} -function isCurrentMap($mapID) { - include_once('./includes/db.inc.php'); - $sql = "SELECT `ID` FROM `mapOfTheDay` - WHERE `mapDate` = CURDATE() AND - `mapID` = '$mapID' - "; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_num_rows($result) == 0) - return false; - else - return true; +$sql = "SELECT `ID`, `displayName`, `dateJoined`, `dateLogin`, `email`, `isAdmin` FROM `users`"; +$result = mysql_query($sql); + +echo " +
+

Administrators Page

+

News:

+

Hello admins, this is our current userlist.

+
+ + + + +"; + +while (list($CUID, $CUsername, $Joined, $LastLogon, $email, $isAdmin) = mysql_fetch_row($result)) { + + //$Joined = Date("d/m/y - g:ia", $Joined); + $Joined = strtotime($Joined); + //$Joined = relative_date($Joined); + $Joined = date("Y-m-d", $Joined); + + $LastLogon = strtotime($LastLogon); + //$LastLogon = relative_date($LastLogon); + $LastLogon = date("Y-m-d", $LastLogon); + + if ($isAdmin == 1) + $isAdmin = "Yes"; + else + $isAdmin = "No"; + + + Echo " + + + + + + +"; + } +Echo " +
IDDisplay name:Joined On:Last LogonEmailAdministrator
$CUID$CUsername$Joined$LastLogon$email$isAdmin
+
+
+ + + +"; + + +//Thank you: +//http://snippets.dzone.com/posts/show/196 +function relative_date($time) { + $today = strtotime(date('M j, Y')); + $reldays = ($time - $today)/86400; + if ($reldays >= 0 && $reldays < 1) { + return 'Today'; + } else if ($reldays >= 1 && $reldays < 2) { + return 'Tomorrow'; + } else if ($reldays >= -1 && $reldays < 0) { + return 'Yesterday'; + } + if (abs($reldays) < 7) { + if ($reldays > 0) { + $reldays = floor($reldays); + return 'in ' . $reldays . ' day' . ($reldays != 1 ? 's' : ''); + } else { + $reldays = abs(floor($reldays)); + return $reldays . ' day' . ($reldays != 1 ? 's' : '') . ' ago'; + } + } + if (abs($reldays) < 182) { + return date('l, F j',$time ? $time : time()); + } else { + return date('l, F j, Y',$time ? $time : time()); + } +} -echo "
"; -echo "
"; -echo "
Solution before"; -echo "
"; -echo $solution; -echo "
"; -echo "
Solution after"; -echo "
"; -$solution = formSolution($solution); -echo $solution; -echo "
"; -echo "
"; -echo "
"; -// echo "
The map for today: -//
Once logged in your best solutions for the map(s) are saved. -//
- Soon i'll fix it so you can see those solutions, and compare them with others. -//
- New maps are generated daily, at 9:00 PM Pacific Standard. (for now...) -//
"; -// echo DisplayMap($motd['map'], $motd['id']); @@ -226,4 +231,4 @@ function createThumbnail($mapMatrix, $idprefix, $width, $height) { } htmlFooter(); -?> +?> \ No newline at end of file -- cgit v1.2.3