function admin_users() { global $ugroups; checkAB('ch0'); $php = $this->swoole; $table = 'st_admin'; $admin_id = $_SESSION['admin_user_id']; $user = $php->db->query("select * from {$table} where id={$admin_id}")->fetch(); $php->tpl->assign('user', $user); $php->tpl->assign('groups', $ugroups); if (!checkAG('st_admin')) { exit; } if (isset($_POST['username'])) { $res = $php->db->query("select count(id) as cc from {$table} where username='******'username']}'")->fetch(); if ($res['cc'] == 0) { $_POST["password"] = Auth::mkpasswd($_POST["username"], $_POST["password"]); $php->db->insert($_POST, $table); } else { Swoole_js::js_back("已存在此用户"); } } if (isset($_GET['del']) and $_GET['del'] != "") { $php->db->query('delete from ' . $table . ' where id=' . $_GET['del']); Swoole_js::location("/admin/admin_news.php?action=users"); } else { $pagesize = 10; $res = $php->db->query("select count(id) as cc from {$table}")->fetch(); $num = $res['cc']; require LIBPATH . '/code/page.php'; $res = $php->db->query("select * from {$table} limit {$offset},{$pagesize}"); $php->tpl->assign("list", $res->fetchall()); $php->tpl->display("admin_adminuser.html"); } }