/* 更新数据库 */ $db->update(tname('admin'), array($_POST['field'] => trim($_POST['val'])), 'admin_id=' . $info['admin_id']); /* 写入日志和系统提示 */ admin_log(admin_privilege_name_fk('admin.php', 'edit') . ': ' . $info['name']); make_json_ok(); } make_json_fail(); } elseif ($_REQUEST['act'] == 'del') { /* 权限检查 */ admin_privilege_valid('admin.php', 'del'); /* 管理员信息(连表角色,拥有信任的角色信息) */ $info = info_admin(array('admin_id' => $_POST['id'])); /* 允许删除检查 */ allow_del($info); /* 删除管理员 */ del_admin(array('admin_id' => $info['admin_id'])); /* 初始化管理员的权限文件 */ init_privilege_sys_pfile($info['username']); /* 写入日志和系统提示 */ admin_log(admin_privilege_name_fk('admin.php', 'del') . ': ' . $info['name']); make_json_ok(); } elseif ($_REQUEST['act'] == 'exportdo') { /* 权限检查 */ admin_privilege_valid('admin.php', 'list'); /* 要导出的字段 */ $fields['sql'] = tname('admin') . '.username,' . tname('admin') . '.name,' . tname('role') . '.name AS role_name'; $fields['filter'] = 'username,name,role_name'; /* 导出当页数据 */ if ($_POST['limit'] == 'page') { /* 取得列表数据 */ $list = list_admin(array('role_info' => $_PRIV['role']));
<?php // configuration require_once "../includes/config.php"; if (isset($_POST["user_to_admin"])) { if (!isset($_POST["admin_reason"])) { apologize("Must provide a reason for the promotion."); } if (make_admin($_POST["user_to_admin"], $_POST["admin_reason"]) === false) { apologize("Something went wrong."); } } elseif (isset($_POST["user_to_deadmin"])) { if (!isset($_POST["deadmin_reason"])) { apologize("Must provide a reason for the demotion."); } if (del_admin($_POST["user_to_deadmin"], $_POST["deadmin_reason"]) === false) { apologize("Something went wrong."); } } // assoc array $admins = get_admin_list(); render_mult(["admin_common.php", "admins.php"], ["title" => $title . " - View Admins", "admins" => $admins]);