admin_list.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <?php
  2. /**
  3. * 管理员列表
  4. *
  5. * @createtime 2018/03/01
  6. * @author 空竹
  7. * @copyright 芝麻开发(http://www.zhimawork.com)
  8. */
  9. require_once('admin_init.php');
  10. require_once('admincheck.php');
  11. $POWERID = '9001';//权限
  12. Admin::checkAuth($POWERID, $ADMINAUTH);
  13. ?>
  14. <!DOCTYPE html>
  15. <html>
  16. <head>
  17. <?php include('htmlhead.inc.php');?>
  18. <title>管理员 - 管理设置 - 管理系统 </title>
  19. </head>
  20. <body>
  21. <div id="header">
  22. <?php include('top.inc.php');?>
  23. <?php
  24. $FLAG_TOPNAV = "system";//主菜单焦点
  25. include('nav.inc.php');
  26. ?>
  27. </div>
  28. <div id="container">
  29. <?php
  30. $FLAG_LEFTMENU = 'admin_list';//左侧子菜单焦点
  31. include('admin_menu.inc.php');
  32. ?>
  33. <div id="maincontent">
  34. <div class="zm_handle">
  35. <div class="btns">
  36. <input type="button" class="btn-handle" id="btn_add" value="添加管理员"/>
  37. </div>
  38. </div>
  39. <div class="tablelist">
  40. <table>
  41. <tr>
  42. <th>帐号</th>
  43. <th>管理员所属组</th>
  44. <th>最近一次登录IP</th>
  45. <th>最近一次登录时间</th>
  46. <th>登录次数</th>
  47. <th>操作</th>
  48. </tr>
  49. <?php
  50. $rows = Admin::getList();
  51. if(!empty($rows)){
  52. foreach($rows as $row){
  53. $groupInfo = new Admingroup($row['group']);
  54. if(!empty($row['logintime']))
  55. $logintime = date('Y-m-d H:i:s',$row['logintime']);
  56. else
  57. $logintime = '';
  58. echo '<tr>
  59. <td>'.$row['account'].'</td>
  60. <td>'.$groupInfo->name.'</td>
  61. <td class="center">'.$row['loginip'].'</td>
  62. <td class="center">'.$logintime.'</td>
  63. <td class="center">'.$row['logincount'].'</td>
  64. <td class="center">';
  65. //当前管理员不能操作
  66. if($adminId != $row['id']) echo '<a href="javascript:reset('.$row['id'].')"><i class="fa fa-refresh"></i></a>
  67. <a href="javascript:edit('.$row['id'].')" ><i class="fa fa-edit"></i></a>
  68. <a href="javascript:del('.$row['id'].')"><i class="fa fa-remove"></i></a>';
  69. echo '
  70. </td>
  71. </tr>
  72. ';
  73. }
  74. }else{
  75. echo '<tr><td class="center" colspan="6">没有数据</td></tr>';
  76. }
  77. ?>
  78. </table>
  79. <div id="pagelist">
  80. <div class="pageinfo">
  81. <span class="table_info">共<?php echo count($rows);?>条数据</span>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. <div class="clear"></div>
  87. </div>
  88. <?php include('footer.inc.php');?>
  89. <script type="text/javascript">
  90. $(function(){
  91. //添加管理员
  92. $('#btn_add').click(function(){
  93. layer.open({
  94. type: 2,
  95. title: '添加管理员',
  96. shadeClose: true,
  97. shade: 0.3,
  98. area: ['500px', '300px'],
  99. content: 'admin_add.php'
  100. });
  101. });
  102. $(".fa-refresh").mouseover(function(){
  103. layer.tips('重置密码', $(this), {
  104. tips: [4, '#3595CC'],
  105. time: 500
  106. });
  107. });
  108. $(".fa-edit").mouseover(function(){
  109. layer.tips('修改', $(this), {
  110. tips: [4, '#3595CC'],
  111. time: 500
  112. });
  113. });
  114. $(".fa-remove").mouseover(function(){
  115. layer.tips('删除', $(this), {
  116. tips: [4, '#3595CC'],
  117. time: 500
  118. });
  119. });
  120. });
  121. //修改
  122. function edit(id){
  123. layer.open({
  124. type: 2,
  125. title: '修改管理员',
  126. shadeClose: true,
  127. shade: 0.3,
  128. area: ['500px', '300px'],
  129. content: 'admin_edit.php?id='+id
  130. });
  131. }
  132. //重置密码
  133. function reset(id){
  134. layer.confirm('确认重置该管理员账号的密码吗?', {
  135. btn: ['确认','取消']
  136. }, function(){
  137. var index = layer.load(0, {shade: false});
  138. $.ajax({
  139. type : 'POST',
  140. data : {
  141. id:id
  142. },
  143. dataType : 'json',
  144. url : 'admin_do.php?act=reset',
  145. success : function(data){
  146. layer.close(index);
  147. var code = data.code;
  148. var msg = data.msg;
  149. switch(code){
  150. case 1:
  151. layer.alert(msg, {icon: 6}, function(index){
  152. location.reload();
  153. });
  154. break;
  155. default:
  156. layer.alert(msg, {icon: 5});
  157. }
  158. }
  159. });
  160. }, function(){}
  161. );
  162. }
  163. //删除管理员
  164. function del(id){
  165. layer.confirm('确认删除该管理员账号吗?', {
  166. btn: ['确认','取消']
  167. }, function(){
  168. var index = layer.load(0, {shade: false});
  169. $.ajax({
  170. type : 'POST',
  171. data : {
  172. id:id
  173. },
  174. dataType : 'json',
  175. url : 'admin_do.php?act=del',
  176. success : function(data){
  177. layer.close(index);
  178. var code = data.code;
  179. var msg = data.msg;
  180. switch(code){
  181. case 1:
  182. layer.alert(msg, {icon: 6}, function(index){
  183. location.reload();
  184. });
  185. break;
  186. default:
  187. layer.alert(msg, {icon: 5});
  188. }
  189. }
  190. });
  191. }, function(){}
  192. );
  193. }
  194. </script>
  195. </body>
  196. </html>