diff --git a/admin/index.php b/admin/index.php index 988fd699..32de2fd3 100644 --- a/admin/index.php +++ b/admin/index.php @@ -2,8 +2,8 @@ /** * @Author: prpr * @Date: 2016-02-03 14:39:50 - * @Last Modified by: prpr - * @Last Modified time: 2016-02-10 15:05:08 + * @Last Modified by: printempw + * @Last Modified time: 2016-03-06 14:07:38 */ require "../includes/session.inc.php"; if (!$user->is_admin) header('Location: ../index.php?msg=看起来你并不是管理员'); @@ -55,8 +55,10 @@ if (!$user->is_admin) header('Location: ../index.php?msg=看起来你并不是 query("SELECT * FROM users"); + $result = $db->query("SELECT * FROM users ORDER BY `uid` LIMIT ".(string)(($page_now-1)*30).", 30"); + $page_total = $db->getRecordNum()/30; while ($row = $result->fetch_array()) { ?> @@ -80,6 +82,39 @@ if (!$user->is_admin) header('Location: ../index.php?msg=看起来你并不是 + diff --git a/assets/css/admin.style.css b/assets/css/admin.style.css index 2a649f45..cf094a66 100644 --- a/assets/css/admin.style.css +++ b/assets/css/admin.style.css @@ -1,8 +1,8 @@ /* * @Author: prpr * @Date: 2016-02-04 16:47:54 -* @Last Modified by: prpr -* @Last Modified time: 2016-02-04 16:48:04 +* @Last Modified by: printempw +* @Last Modified time: 2016-03-06 14:11:26 */ .pure-table { margin: 80px auto 0; @@ -24,3 +24,47 @@ input { .fw { width: 100%; } +.pagination { + display: inline-block; + padding-left: 0; + margin: 20px 0; + border-radius: 4px; +} +.pagination > li { + display: inline; +} +.pagination > li:first-child > a, .pagination > li:first-child > span { + margin-left: 0; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; +} +.pagination > li > a, .pagination > li > span { + position: relative; + float: left; + padding: 6px 12px; + margin-left: -1px; + line-height: 1.42857143; + color: #337ab7; + text-decoration: none; + background-color: #fff; + border: 1px solid #ddd; +} +.pagination > li > a:focus, .pagination > li > a:hover { + z-index: 3; + color: #fff; + background-color: #337ab7; + border-color: #337ab7; +} +.pagination > .active > a, .pagination > .active > a:focus, .pagination > .active > a:hover { + z-index: 3; + color: #fff; + cursor: default; + background-color: #337ab7; + border-color: #337ab7; +} +.pagination > .disabled > a, .pagination > .disabled > a:focus, .pagination > .disabled > a:hover { + color: #777; + cursor: not-allowed; + background-color: #fff; + border-color: #ddd; +} diff --git a/includes/Database.class.php b/includes/Database.class.php index e016f29a..c030e0f3 100644 --- a/includes/Database.class.php +++ b/includes/Database.class.php @@ -2,8 +2,8 @@ /** * @Author: printempw * @Date: 2016-02-02 21:59:06 - * @Last Modified by: prpr - * @Last Modified time: 2016-02-06 23:06:30 + * @Last Modified by: printempw + * @Last Modified time: 2016-03-06 13:41:24 */ class Database @@ -60,6 +60,11 @@ class Database return $this->query($sql)->num_rows; } + public function getRecordNum() { + $sql = "SELECT * FROM users WHERE 1"; + return $this->query($sql)->num_rows; + } + public function checkRecordExist($key, $value) { return ($this->getNumRows($key, $value) != 0) ? true : false; }