<?
defined('ROOT_PHPLEFT') or exit('phpleft: Not page');
/*
	phpleftDms Copyright (c) 2011 phpleft.COM
	商业授权：QQ45150208
	
*/


if ($post=='add'){
$rs= new admin;
$set['limits'].='0';
foreach($limits as $i=> $c) {
  $set['limits'].=','.$c;
}
$do->into($set,'member_group');
$sett = sql_cache("table=member_group");
$files = "set-group.php";
$pathcache = PL_ROOT.$PL_CFG['cache']."/";
cache_write($files, $sett, $pathcache);
msg('添加成功', 'phpleft.php?file=user&in=group&show=add',$lefts);
}elseif ($post=='del'){
$db->query("DELETE FROM ".$PL_CFG['tb_pre']."member_group WHERE id='".$id."'");
$sett = sql_cache("table=member_group");
$files = "set-group.php";
$pathcache = PL_ROOT.$PL_CFG['cache']."/";
cache_write($files, $sett, $pathcache);
msg('删除成功', 'phpleft.php?file=user&in=group',$lefts);	
}elseif ($post=='bj'){
$rs= new admin;
$set['limits'].='0';
foreach($limits as $i=> $c) {
  $set['limits'].=','.$c;
}
$do->update($set,'member_group','id',$id);
$sett = sql_cache("table=member_group");
$files = "set-group.php";
$pathcache = PL_ROOT.$PL_CFG['cache']."/";
cache_write($files, $sett, $pathcache);
msg('设置更新成功', 'phpleft.php?file=user&in=group&show=bj&id='.$id,$lefts);
}else{
$menu = array (
	array('','phpleft.php?file=user&in=group', '会员级别',0),
	array('add','phpleft.php?file=user&in=group&show=add', '添加级别',0),
	);


$menulist = cache_read('menu.php',PL_ROOT.$PL_CFG['cache'].'/');
foreach($menulist as $i=> $c) {
	if ($c['id']>1 and $c['module']<>''){
  $values[$i][] = $c['id'];
  $values[$i][] = $c['name'];
	}
}
$list = sql_cache("table=member_group");
$set = $id ? sql_show("table=member_group&where=id=".$id):array();
include 't/'.$in.'.php';
}


?>