Example #1
0
    if (file_exists('../configs/web.xml')) {
        $xml = simplexml_load_file('../configs/web.xml');
        foreach ($xml->xpath("/web/info/add") as $val) {
            $val['value'] = $_POST['' . $val['filed'] . ''];
        }
        $xml->saveXML('../configs/web.xml');
        $isbool = true;
    } else {
        info_sysadmin_error('读取站点配置文件失败');
    }
    if ($isbool) {
        success_msg('修改成功', prev_url());
    } else {
        success_msg('修改失败', 'back');
    }
}
if ($action == '') {
    if (file_exists('../configs/web.xml')) {
        $webinfo = array();
        $xml = simplexml_load_file('../configs/web.xml');
        foreach ($xml->xpath('/web/info/add') as $value) {
            $webinfo[] = $value;
        }
        $smarty->assign('webinfo', $webinfo);
    } else {
        info_sysadmin_error('读取站点配置文件失败');
    }
}
$smarty->assign("action", $action);
$smarty->display('sysadmin/web_info.html');
require_once 'footer.php';
Example #2
0
    $count = $db->query_count($table, "AND parent_id={$parent_id} AND name='" . $name . "' AND id<>{$id}");
    if ($count > 0) {
        info_sysadmin_notice('该分类名称已经存在,请更换');
    }
    #检测上级分类是否是子类或本身
    if ($parent_id == $id) {
        info_sysadmin_error('上级分类不能是本身');
    }
    $typeList = array();
    display_type($db, $typeList, $id, 0);
    if (!empty($typeList)) {
        foreach ($typeList as $item) {
            $type_array[] = $item['id'];
        }
        if (in_array($_POST['parent_id'], $type_array)) {
            info_sysadmin_error('上级分类不能是自己的子类');
        }
    }
    $mod_content = "name='{$name}',sort={$sort},parent_id={$parent_id},description='{$description}',image='{$image}'";
    $where = 'id=' . $id;
    $isbool = $db->update($table, $mod_content, $where);
    if ($isbool !== false) {
        success_msg('修改成功', "?");
    } else {
        error_msg('修改失败', 'back');
    }
}
/*
 * 递归所有分类
 */
function display_type($db, &$typeList, $parent_id, $level)
Example #3
0
if ($action == 'edit') {
    $id = $_POST['id'];
    $user_id = $_POST['user_id'];
    $username = $_POST['username'];
    $email = $_POST['email'];
    $role_id = @$_POST['role_id'];
    $state_id = @$_POST['state_id'];
    //检测用户名
    $count = $db->query_count($table, "AND user_id='{$user_id}' AND id<>{$id}");
    if ($count > 0) {
        info_sysadmin_error('用户名“' . $user_id . '”被占用');
    }
    //检测email
    $count = $db->query_count($table, "AND email='{$email}' AND id<>{$id}");
    if ($count > 0) {
        info_sysadmin_error('Email“' . $email . '”被占用');
    }
    if ($id == 1) {
        $mod_content = "user_id='{$user_id}',username='******',`email`='{$email}'";
    } else {
        $mod_content = "user_id='{$user_id}',username='******',`email`='{$email}',role_id={$role_id},state_id={$state_id}";
    }
    $where = 'id=' . $id;
    $isbool = $db->update($table, $mod_content, $where);
    if ($isbool !== false) {
        success_msg('修改成功', '?');
    } else {
        error_msg('修改失败', 'back');
    }
}
if ($action == '') {
Example #4
0
        if ($password == '') {
            info_sysadmin_error('请输入新密码');
        }
    }
    #检测email
    $count = $db->query_count($table, "and email='{$email}' and id<>{$id}");
    if ($count > 0) {
        info_sysadmin_error('Email“' . $email . '”被占用');
    }
    #不修改密码
    if (!empty($oldpassword)) {
        #检测旧密码
        $result = $db->query("SELECT * FROM cn_admin WHERE `user_id`='{$user_id}' AND `password`='" . md5($oldpassword) . "'");
        $admin = $db->fetch($result);
        if (!$admin) {
            info_sysadmin_error('旧密码不正确', 'back');
        }
        $mod_content = "username='******',password='******',`email`='{$email}'";
    } else {
        $mod_content = "username='******',`email`='{$email}'";
    }
    $where = "user_id='{$user_id}'";
    $isbool = $db->update($table, $mod_content, $where);
    if ($isbool !== false) {
        success_msg('修改成功', '?');
    } else {
        error_msg('修改失败', 'back');
    }
}
if ($action == '') {
    $result = $db->query("SELECT * FROM cn_admin WHERE user_id='" . $_SESSION['cn_sysadmin']['user_id'] . "'");
Example #5
0
}
if ($action == "bj") {
    $id = $_GET['id'];
    $result = $db->query_by_id($table, $id);
    $row = $db->fetch($result);
    $smarty->assign('role', $row);
}
if ($action == "edit") {
    $id = $_POST['id'];
    $name = $_POST['name'];
    $mod_content = "name='{$name}'";
    $where = 'id=' . $id;
    //检测名称
    $count = $db->query_count($table, "and name='{$name}' and id<>{$id}");
    if ($count > 0) {
        info_sysadmin_error('角色名称"' . $name . '"被占用');
    }
    $isbool = $db->update($table, $mod_content, $where);
    if ($isbool !== false) {
        success_msg('修改成功', '?');
    } else {
        error_msg('修改失败', 'back');
    }
}
if ($action == "rolemenu") {
    $id = $_GET['id'];
    $roleList = array();
    $result = $db->query('SELECT * FROM cn_role WHERE id=' . $id);
    $role = $db->fetch($result);
    $smarty->assign('role', $role);
    /*$result1 = $db->query('SELECT * FROM cn_role');