diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2011-12-12 23:40:18 -0800 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2011-12-12 23:40:18 -0800 |
commit | fba0211254059e3fedfb32054c118026c5f2ed3e (patch) | |
tree | 6ac330c1473af07aeb5e3438a03797310f0c9384 /pages/admin.php | |
parent | a8360b3f44022d2dfbff9a6a47838cdb52c5dd99 (diff) | |
download | pathery-fba0211254059e3fedfb32054c118026c5f2ed3e.tar.xz |
Admin page now shows memberlist. Sound volume reduced to 50%. Social networks added to about. Minor adjustments.
Diffstat (limited to 'pages/admin.php')
-rw-r--r-- | pages/admin.php | 153 |
1 files changed, 79 insertions, 74 deletions
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 "<br />Best solution for this map: $bestMoves by $byName";
-
- //$map = MergeMapSolution($motd['map'], $solution);
- $map = MergeMapSolution($map, $solution);
- echo DisplayMap($map, $mapID);
-
- echo "<br />";
- echo "<br />Is Current:";
- $is = isCurrentMap(77);
- echo "<br />$is";
- $is = isCurrentMap(20);
- echo "<br />$is";
- $is = isCurrentMap(76);
- echo "<br />$is";
- $is = isCurrentMap(75);
- echo "<br />$is";
- $is = isCurrentMap(74);
- echo "<br />$is";
- echo "<br />";
-
-}
-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 "
+<center>
+<h3>Administrators Page</h3>
+<p>News:</p>
+<p>Hello admins, this is our current userlist.</p>
+</center>
+<table style='padding-left:20px;'>
+<tr>
+<th>ID</th><th>Display name:</th><th>Joined On:</th><th>Last Logon</th><th>Email</th><th>Administrator</th>
+</tr>
+";
+
+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 "<tr>
+<td>$CUID</td>
+<td><a href='javascript:;'>$CUsername</a></td>
+<td>$Joined</td>
+<td>$LastLogon</td>
+<td>$email</td>
+<td>$isAdmin</td>
+</tr>";
+
}
+Echo "
+ </table>
+ <br />
+ <br />
+ </td>
+ </tr>
+</table>
+";
+
+
+//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 "<br />";
-echo "<br />";
-echo "<br />Solution before";
-echo "<br />";
-echo $solution;
-echo "<br />";
-echo "<br />Solution after";
-echo "<br />";
-$solution = formSolution($solution);
-echo $solution;
-echo "<br />";
-echo "<br />";
-echo "<br />";
-// echo "<center><b> The map for today:
-// <br />Once logged in your best solutions for the map(s) are saved.
-// <br />- Soon i'll fix it so you can see those solutions, and compare them with others.
-// <br />- New maps are generated daily, at 9:00 PM Pacific Standard. (for now...)
-// </b></center>";
-// echo DisplayMap($motd['map'], $motd['id']);
@@ -226,4 +231,4 @@ function createThumbnail($mapMatrix, $idprefix, $width, $height) { }
htmlFooter();
-?>
+?>
\ No newline at end of file |