admin_add.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. </head>
  19. <body>
  20. <div class="zm_form_wrap">
  21. <p>
  22. <label>帐号</label>
  23. <input type="text" class="text-input input-length-30" name="account" />
  24. <span class="warn-inline">* </span>
  25. </p>
  26. <p>
  27. <label>密码</label>
  28. <input type="password" class="text-input input-length-30" name="password" />
  29. <span class="warn-inline">* </span>
  30. </p>
  31. <p>
  32. <label>管理员所属组</label>
  33. <select name="group" class="select-option" id="group">
  34. <?php
  35. $group = Admingroup::getList();
  36. foreach($group as $g){
  37. $gid = $g['id'];
  38. $gname = $g['name'];
  39. echo '<option value="'.$gid.'">'.$gname.'</option>';
  40. }
  41. ?>
  42. </select>
  43. <span class="warn-inline">* </span>
  44. </p>
  45. <p>
  46. <label>  </label>
  47. <input type="submit" id="btn_submit" class="btn_submit" value="提 交" />
  48. </p>
  49. </div>
  50. <script type="text/javascript">
  51. $(function(){
  52. $('#btn_submit').click(function(){
  53. var account = $('input[name="account"]').val();
  54. var group = $('#group').val();
  55. var password = $('input[name="password"]').val();
  56. if(account == ''){
  57. layer.msg('账号不能为空');
  58. return false;
  59. }
  60. if(password == ''){
  61. layer.msg('密码不能为空');
  62. return false;
  63. }
  64. if(group == ''){
  65. layer.msg('请选择管理员组');
  66. return false;
  67. }
  68. $.ajax({
  69. type : 'POST',
  70. data : {
  71. account : account,
  72. password : password,
  73. group : group
  74. },
  75. dataType : 'json',
  76. url : 'admin_do.php?act=add',
  77. success : function(data){
  78. var code = data.code;
  79. var msg = data.msg;
  80. switch(code){
  81. case 1:
  82. layer.alert(msg, {icon: 6,shade: false}, function(index){
  83. parent.location.reload();
  84. });
  85. break;
  86. default:
  87. layer.alert(msg, {icon: 5});
  88. }
  89. }
  90. });
  91. });
  92. });
  93. </script>
  94. </body>
  95. </html>