diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2013-01-23 22:25:28 -0800 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2013-01-23 22:25:28 -0800 |
commit | 7969dcfa62ac271ed6ef6d6b8d10bcf0659e25b5 (patch) | |
tree | a902eceb5a2186dc01677392863b0c4aa0c5c377 /includes/datas.php | |
parent | 1e4045408872ac9bc83417f9c58ca740e54fff3d (diff) | |
download | pathery-7969dcfa62ac271ed6ef6d6b8d10bcf0659e25b5.tar.xz |
A functional Memberlist again! New and improved!
Diffstat (limited to 'includes/datas.php')
-rw-r--r-- | includes/datas.php | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/includes/datas.php b/includes/datas.php index 8ae5d5f..124b303 100644 --- a/includes/datas.php +++ b/includes/datas.php @@ -708,7 +708,17 @@ function getChampionPointsArray() { } //Select Members -function getMembers($order, $pageNumber = 1, $pageDivide = 50) { +function getMembers($pageNumber = 1, $pageDivide = 50, $order = 'DESC', $orderBy = 'dateJoined') { + + 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 +730,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 +755,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 "; |