<?php
include INDEX_ROOT.'admin/head.php';
admin_head('部门处理层');
$m=$_GET['m'];
if($m=='new'){
    if(empty($_POST))sysmsg('POST来的数据不能为空');
    if(empty($_POST['name']))sysmsg('介绍不能为空');
    if(empty($_POST['scope']))sysmsg('权限点不能为空');

    $name=$_POST['name'];
    $scope=$_POST['scope'];

    $account=new \auth\scope();
    $account->reg($scope,$name,$_POST['def']);
    alert('添加成功');
    go('/admin/scope.html');
}elseif ($m=="edit"){
    if(empty($_POST))sysmsg('POST来的数据不能为空');
    if(empty($_POST['name']))sysmsg('介绍不能为空');
    if(empty($_GET['scope']))sysmsg('权限点不能为空');

    $scope=$_GET['scope'];//改不了
    $name=$_POST['name'];//空不了
    $def=$_POST['def'];

    $account=new \auth\scope();
    $account->edit($scope,$name,$_POST['def']);
    alert('修改成功');
    go('/admin/scope.html');
}else{
    alert('参数错误，请重新输入');
    go('/admin/scope.html');
}

admin_foot();
?>