diff options
Diffstat (limited to 'includes/datas.php')
-rw-r--r-- | includes/datas.php | 27 |
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 "; |