<?php
	$acl=$_SESSION["acl"];
	if (strlen($acl)<1 || !strpos($acl,"<1002>")) {	//没有权限
		ob_clean();
		header("Location: ../accesserror.html");
		exit;
	}
?>


<?php
	$operator=$_REQUEST["operator"];
	if ($operator=="") {
		echo("<html><body><p align=center>必须先选择一个操作员！</p></body></html>");
		exit;
	}
?>

<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<script language="javascript">
function checkall()
{
	for (i=0;i<document.form1.elements.length;i++) {
		if (document.form1.elements(i).type=="checkbox") {
			document.form1.elements(i).checked=true;
		}
	}
}
</script>
<title>操作员权限修改</title>
</head>

<body background="../bkg.bmp">

<p align="center"><font size="5"><b>操作员权限修改</b></font></p>
<hr color="#999966">


<form name=form1 method="POST" action="changeacl.php">
  <input type="hidden" name="operator" value="<?php echo $operator; ?>">
  <div align="center">
    <center>
    操作员“<?php echo $operator; ?>”权限列表<br>
    <table border="1" cellpadding="0" cellspacing="0" bordercolor="#008080">
<?php
		$db=mysql_pconnect(get_cfg_var("SIPSERVER"),get_cfg_var("SIPUSER"),get_cfg_var("SIPPWD")); 
		mysql_select_db(get_cfg_var("SIPDB"),$db);
		$acl="";
		$rs = mysql_query("select acl from operators where operator='".$operator."'",$db);
		if ($row = mysql_fetch_array($rs)) {
			$acl=$row["acl"];
		}
		mysql_free_result($rs);
		$rs = mysql_query("select appcode,appname from module order by appcode",$db);
		$n=0;
		while ($row = mysql_fetch_array($rs)) {
			if (strlen($acl)>$n && substr($acl,$n,1)=="1") {
				echo("<tr><td align=left><input type=checkbox name=var".$row["appcode"]." value=on checked>".$row["appname"]."</td></tr>");
			}
			else {
				echo("<tr><td align=left><input type=checkbox name=var".$row["appcode"]." value=on>".$row["appname"]."</td></tr>");
			}
			$n=$n+1;
		}
		mysql_free_result($rs);
		mysql_close($db);
?>
    </table>
    </center>
  </div>
  <p align="center"><input type=button name=B2 value=全部选择 onclick='javascript:checkall();'>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="确定修改" name="B1"></p>
</form>

<p align="center">
</p>



<hr>
<p align="center">SIP宽带上网计费管理系统</p>
<p align="center">作者：<b>深圳市飞沃软件有限公司</b></p>


</body>

</html>
