summaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorBlueRaja <BlueRaja.admin@gmail.com>2013-01-24 03:07:21 -0600
committerBlueRaja <BlueRaja.admin@gmail.com>2013-01-24 03:07:21 -0600
commit555cb086402521801ef1a3bfa893c3a9aa734715 (patch)
tree93edcf7428124bdd02146ddf3b4f9a894b5ae35d /includes
parentb6dc90e3f658a8201424aafec8e304c74d981022 (diff)
parent5758770c5c0733383858463b2b33cadcc03b6f2f (diff)
downloadpathery-555cb086402521801ef1a3bfa893c3a9aa734715.tar.xz
Merge branch 'master' of git.raylu.net:pathery
Conflicts: db updates.sql
Diffstat (limited to 'includes')
-rw-r--r--includes/datas.php27
1 files changed, 20 insertions, 7 deletions
diff --git a/includes/datas.php b/includes/datas.php
index 8ae5d5f..6566b89 100644
--- a/includes/datas.php
+++ b/includes/datas.php
@@ -708,7 +708,19 @@ function getChampionPointsArray() {
}
//Select Members
-function getMembers($order, $pageNumber = 1, $pageDivide = 50) {
+function getMembers($pageNumber = 1, $pageDivide = 50, $order = 'DESC', $orderBy = 'dateJoined') {
+
+ if ($pageDivide <= 0)
+ $pageDivide = 50;
+ if ($order !== 'ASC' AND $order !== 'DESC')
+ $order = 'DESC';
+ $columns = array('dateJoined', 'dateLogin', 'championPoints',
+ 'totalMazes', 'totalWins', 'totalTies', 'totalMovesThisWeek',
+ 'totalMoves', 'display');
+ if (!in_array($orderBy, $columns))
+ $orderBy = 'dateJoined';
+ //These values are now confirmed.
+ $sqlOrder = "ORDER BY `$orderBy` $order";
$top = $pageNumber * $pageDivide;
$bottom = $top - $pageDivide;
@@ -720,7 +732,7 @@ function getMembers($order, $pageNumber = 1, $pageDivide = 50) {
$row = mysql_fetch_assoc($result);
$total = $row['count'];
- $output['pageCount'] = $total / $pageDivide;
+ $output['pageCount'] = ceil(($total / $pageDivide));
$pageRequest = 'all';
if ($pageRequest == 'all') {
@@ -745,17 +757,18 @@ function getMembers($order, $pageNumber = 1, $pageDivide = 50) {
WHERE solutions.userID = users.ID AND
solutions.dateModified BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 7 DAY) AND CURRENT_DATE)
, 0) AS totalMovesThisWeek,
- users.totalMazes,
- users.totalWins,
- users.totalTies,
+ users.championPoints as championPoints,
+ users.totalMazes as totalMazes,
+ users.totalWins as totalWins,
+ users.totalTies as totalTies,
IfNull(userData.wallColor, '#666666') as wallColor,
- IfNull(userData.displayColor, '#cccccc'),
+ IfNull(userData.displayColor, '#cccccc') as displayColor,
userData.wallEmblem as wallEmblem,
users.datejoined as dateJoined,
users.dateLogin as dateLogin
FROM `users`
LEFT JOIN `userData` ON users.ID = userData.userID
- $order
+ $sqlOrder
LIMIT $limitTop, $pageDivide
";