mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-01-30 14:09:58 +08:00
added user search
This commit is contained in:
parent
8383e076e3
commit
8921fe38c8
@ -3,7 +3,7 @@
|
|||||||
* @Author: printempw
|
* @Author: printempw
|
||||||
* @Date: 2016-03-06 14:19:20
|
* @Date: 2016-03-06 14:19:20
|
||||||
* @Last Modified by: printempw
|
* @Last Modified by: printempw
|
||||||
* @Last Modified time: 2016-03-27 09:45:54
|
* @Last Modified time: 2016-03-27 10:53:06
|
||||||
*/
|
*/
|
||||||
require "../libraries/session.inc.php";
|
require "../libraries/session.inc.php";
|
||||||
if (!$user->is_admin) header('Location: ../index.php?msg=看起来你并不是管理员');
|
if (!$user->is_admin) header('Location: ../index.php?msg=看起来你并不是管理员');
|
||||||
@ -17,7 +17,6 @@ if (isset($_GET['show'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data['script'] = <<< 'EOT'
|
$data['script'] = <<< 'EOT'
|
||||||
<script type="text/javascript" src="../assets/js/preview.utils.js"></script>
|
|
||||||
<script type="text/javascript" src="../assets/js/admin.utils.js"></script>
|
<script type="text/javascript" src="../assets/js/admin.utils.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$('#page-select').on('change', function() {
|
$('#page-select').on('change', function() {
|
||||||
@ -25,4 +24,6 @@ $('#page-select').on('change', function() {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
EOT;
|
EOT;
|
||||||
|
if (isset($_GET['show']))
|
||||||
|
$data['script'] .= '<script type="text/javascript" src="../assets/js/preview.utils.js"></script>';
|
||||||
View::show('footer', $data); ?>
|
View::show('footer', $data); ?>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: printempw
|
* @Author: printempw
|
||||||
* @Date: 2016-02-04 16:47:54
|
* @Date: 2016-02-04 16:47:54
|
||||||
* @Last Modified by: printempw
|
* @Last Modified by: printempw
|
||||||
* @Last Modified time: 2016-03-27 09:40:35
|
* @Last Modified time: 2016-03-27 10:38:36
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@import url(https://fonts.googleapis.com/css?family=Ubuntu);
|
@import url(https://fonts.googleapis.com/css?family=Ubuntu);
|
||||||
@ -56,3 +56,12 @@ td[class='key'], td[class='value'] {
|
|||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
.user-search-form {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
.user-search-input {
|
||||||
|
display: inline;
|
||||||
|
width: 30%;
|
||||||
|
float: right;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
<h1>
|
<h1>
|
||||||
用户管理
|
用户管理
|
||||||
<small>User Manage</small>
|
<small>User Manage</small>
|
||||||
|
<form method="post" action="manage.php" class="user-search-form">
|
||||||
|
<input type="text" name="search-username" class="form-control user-search-input" placeholder="输入用户名,回车搜索。" value="<?php echo Utils::getValue('search-username', $_POST); ?>">
|
||||||
|
</form>
|
||||||
</h1>
|
</h1>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@ -27,8 +30,14 @@
|
|||||||
<?php
|
<?php
|
||||||
$page_now = isset($_GET['page']) ? $_GET['page'] : 1;
|
$page_now = isset($_GET['page']) ? $_GET['page'] : 1;
|
||||||
$db = new Database\Database();
|
$db = new Database\Database();
|
||||||
$result = $db->query("SELECT * FROM users ORDER BY `uid` LIMIT ".(string)(($page_now-1)*30).", 30");
|
|
||||||
$page_total = round($db->getRecordNum()/30);
|
if (isset($_POST['search-username'])) {
|
||||||
|
$result = $db->query("SELECT * FROM users WHERE `username` LIKE '%".$_POST['search-username']."%' ORDER BY `uid` LIMIT ".(string)(($page_now-1)*30).", 30");
|
||||||
|
} else {
|
||||||
|
$result = $db->query("SELECT * FROM users ORDER BY `uid` LIMIT ".(string)(($page_now-1)*30).", 30");
|
||||||
|
}
|
||||||
|
|
||||||
|
$page_total = round($result->num_rows/30);
|
||||||
while ($row = $result->fetch_array()) { ?>
|
while ($row = $result->fetch_array()) { ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $row['uid']; ?></td>
|
<td><?php echo $row['uid']; ?></td>
|
||||||
@ -62,13 +71,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if ($page_total != 0): ?>
|
||||||
<ul class="pager">
|
<ul class="pager">
|
||||||
<?php if ($page_now != 1 && $page_now >= 5): ?>
|
<?php if ($page_now != 1 && $page_now >= 5): ?>
|
||||||
<li>
|
<li><a href="manage.php?page=1">1...</a></li>
|
||||||
<a href="manage.php?page=1">1...</a>
|
|
||||||
</li>
|
|
||||||
<?php endif;
|
<?php endif;
|
||||||
|
|
||||||
|
// calculate page numbers to show
|
||||||
if ($page_now > $page_total - 2) {
|
if ($page_now > $page_total - 2) {
|
||||||
$from = $page_total - 4;
|
$from = $page_total - 4;
|
||||||
$to = $page_total;
|
$to = $page_total;
|
||||||
@ -94,6 +103,7 @@
|
|||||||
} ?>
|
} ?>
|
||||||
</select>
|
</select>
|
||||||
</ul>
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
</section><!-- /.content -->
|
</section><!-- /.content -->
|
||||||
</div><!-- /.content-wrapper -->
|
</div><!-- /.content-wrapper -->
|
||||||
|
Loading…
Reference in New Issue
Block a user