<!--#include file=down_conn.asp-->
<!-- #include file="inc/const.asp" -->
<head>
<title>--管理页面</title>
<base target="footer">
</head>
<%
Dvbbs.LoadTemplates("")
Dvbbs.Head()
	dim admin_flag,menu,type1,type2,type3,type4,rs1,sql1,rss
	admin_flag="22"
	if not Dvbbs.master then
		Errmsg=ErrMsg + "<BR><li>本页面为管理员专用，请<a href=admin_login.asp target=_top>登陆</a>后进入。<br><li>您没有管理本页面的权限。"
		dvbbs_error()
	else
menu=request("menu")
	if menu=1 then
	call autoadmin()
	else
	call main()
	end if
sub main
   Set rs=Server.CreateObject("Adodb.RecordSet")   
   sql="select * from admin where flag>0 order by flag,id"   
   rs.Open sql,conndown,1,1
%>
<body  leftmargin="0" topmargin="0">
 
  <table border="0" width="100%" cellspacing="1">
    <tr>
      <td ></td>
      <td ><font color="#FF0000">主管理员 </font>◇拥有一切操作权利 <BR>
        <font color="#FF0000">超级管理员</font>可以操作前台任何管理：添加、上传、修改、删除<BR>
        <font color="#FF0000">普通管理员</font>可以进行◇添加、上传、修改部分除（贵宾下载，特约下载）<BR>
        <font color="#FF0000">普通用户 </font>可以进行◇添加、上传、修改自己添加的信息（站长可锁定权限） <BR>
        <font color="#FF0000">锁定上传 </font>只可以进行◇添加、修改自己添加的信息。不能上传文件<BR>
        <font color="#FF0000">锁定添加 </font>不能执行任何操作！<BR>
      </td>
      <td ></td>
    </tr>
  </table>
  <p> <a href=admin_down_adminuser.asp?menu=1><font color="#0000FF">自动添加管理员</font></a> | <a href=admin_down_adduser.asp><font color="#0000FF">手工添加管理员/ 锁定用户</font></a></p>
  <table width="97%" border="0" cellspacing="2" cellpadding="0" height="29" class="tableBorder2">
    <tr>
      <TH width="5%" align="center" nowrap> <div align="center">序号</div></TH>
      <TH width="15%" nowrap> <div align="center">用户名</div></TH>
      <TH width="15%" nowrap> <p align="center">加入时间 </TH>
      <TH width="50%" nowrap> <div align="center">权限</div></TH>
      <TH width="15%" nowrap> <div align="center">操作</div>
      </td></TH>
    </tr>
  </table>
  <%while not rs.EOF %>
  <form method="post" action="admin_down_saveuser.asp" >
    <table width="98%" border="0" align="center" cellpadding="0" cellspacing="1"   class="tableBorder2">
      <tr>
        <td width="5%" height="1" align="center"><%=rs("id")%> </td>
        <td width="15%" height="1" align="center"> <%=rs("username")%> </td>
        <td width="15%" height="1" align="center"><%=rs("addtime")%></td>
        <td width="50%" height="1" align="center"><%if rs("flag")>1 then%>
         
            <input type=radio name="flag" value="2" <%if rs("flag")=2 then%>checked<%end if%>>
            超管
            <input type=radio name="flag" value="3" <%if rs("flag")=3 then%>checked<%end if%>>
            普管
            <input type=radio name="flag" value="4" <%if rs("flag")=4 then%>checked<%end if%>>
            锁定上传
            <input type=radio name="flag" value="5" <%if rs("flag")=5 then%>checked<%end if%>>
            锁定添加
          <%else
response.write "下载中心主管理员"
end if%>
        </td>
        <td width="15%" height="1" align="center"><%if rs("flag")>=1 then%>
          
            <input type="submit" name="Submit" value="修改">
&nbsp;
            <input type="submit" name="Submit" value="删除">
            <input type="hidden" name="user" value="<%=rs("username")%>">
         
          <%end if%>
        </td>
      </tr>
    </table>
  </form>
  <%
         
     rs.MoveNext
     
     Wend
  %>
</div>
<%
  rs.Close
  set rs=Nothing
  
  conndown.Close
  set conndown=Nothing
%>
</body>
<%end sub
sub autoadmin()
type1="管理员"
type2="超级版主"
type3="版主"
type4="贵宾"

Set rs1 = Server.CreateObject("ADODB.Recordset")
sql1="select * from [admin]"
rs1.open sql1,conndown,1,3

Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from [DV_user] where userclass='"&type1&"'"
rs.open sql,conn,0,1

if not(rs.eof and rs.bof) then
do while not rs.eof
set rss=conndown.execute("select * from [admin] where username='"&rs("username")&"'")
if rss.eof and rss.bof then
rs1.addnew
rs1("username")=rs("username")
rs1("flag")=1
rs1("addtime")=date()
rs1.update
end if
rs.movenext
loop
end if

Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from [DV_user] where userclass='"&type2&"'"
rs.open sql,conn,0,1

if not(rs.eof and rs.bof) then
do while not rs.eof
set rss=conndown.execute("select * from [admin] where username='"&rs("username")&"'")
if rss.eof and rss.bof then
rs1.addnew
rs1("username")=rs("username")
rs1("flag")=2
rs1("addtime")=date()
rs1.update
end if
rs.movenext
loop
end if

Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from [DV_user] where userclass='"&type3&"' or userclass='"&type4&"' "
rs.open sql,conn,0,1

if not(rs.eof and rs.bof) then
do while not rs.eof
set rss=conndown.execute("select * from [admin] where username='"&rs("username")&"'")
if rss.eof and rss.bof then
rs1.addnew
rs1("username")=rs("username")
rs1("flag")=3
rs1("addtime")=date()
rs1.update
end if
rs.movenext
loop
end if
response.write "修改成功！"
end sub
end if%>
