<?
include_once("../inc/config.php");
include_once("../inc/publicfun.php");
include_once("../inc/ftbbsdbclass.php");
include_once("../conn.php");
include_once("check_master.php");

$dbqs=$_SESSION['qs'];
if ($dbqs!=2){
$dis="disabled";
}

if ($_POST["act"]=="y"){
   //$adminqs=$_POST["adminqs"];
   $list=$_POST["adminqs"];
   $adminuser=$_POST["adminuser"];
   $adminpwd=md5($_POST["adminpwd"]);
   $db_qs=$_POST["dbqs"];
   if (count($list)==1){
   $adminqs=$list[0];
   }
   elseif (count($list)==2){
   $adminqs=$list[0].",".$list[1];
   }
   elseif (count($list)==3){
   $adminqs=$list[0].",".$list[1].",".$list[2];
   }
   else{
   $adminqs="0,0,0";
   }
   $sql="insert into {$tablepre}ftbbs_admin (admin_user,admin_pwd,lasttime,qs,adminqs) values('".$adminuser."','".$adminpwd."','".$getnow."','".$db_qs."','".$adminqs."')";
   mysql_query($sql);
   $db->close(); 
   header("Location:ftbbs_admin.php");
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$charset?>">
<title>添加管理用户</title>
<link href="../css/xmwuye.css" rel="stylesheet" type="text/css">
</head>

<body>
  <br>
  <br>
  <br>
  <table width="71%" border="0" align="center">
  <form name="form1" method="post" action="">
    <tr bgcolor="f8f8f8"> 
      <td height="30" colspan="2"> 
        <div align="center">添加管理员</div></td>
    </tr>
    <tr bgcolor="f8f8f8"> 
      <td width="24%" height="30"> 
        <div align="right">用户名：</div></td>
      <td width="76%" height="30"> 
        <input name="adminuser" type="text" id="adminuser" size="27"></td>
    </tr>
    <tr bgcolor="f8f8f8"> 
      <td height="30"> 
        <div align="right">密&nbsp;&nbsp;码：</div></td>
      <td height="30"> <input name="adminpwd" type="password" id="adminpwd" size="27"></td>
    </tr>
    <tr bgcolor="f8f8f8"> 
      <td height="30"> 
        <div align="right">用户身份：</div></td>
      <td height="30"><input type="radio" name="dbqs" value="2">
        超级管理员 
        <input name="dbqs" type="radio" value="1" checked>
        普通管理员</td>
    </tr>
    <tr bgcolor="f8f8f8"> 
      <td height="30"> 
        <div align="right">操作权限：</div></td>
      <td height="30"><input name="adminqs[]" type="checkbox" id="adminqs" value="1">
        添加 
        <input name="adminqs[]" type="checkbox" id="adminqs" value="2">
        修改 
        <input name="adminqs[]" type="checkbox" id="adminqs" value="3">
        删除</td>
    </tr>
    <tr bgcolor="f8f8f8"> 
      <td height="30">&nbsp;</td>
      <td height="30"><input type="submit" name="Submit" value="确定" <?=$dis?>>
        <input name="act" type="hidden" id="act" value="y"></td>
    </tr>
	</form>
  </table>
</body>
</html>