<!--#include file="../Inc.asp"-->
<!--#include file="../ydzq.asp"-->
<!--#include file="../forbbs.asp"-->
<%call head()
Call FortxtChat
call saycardd("管理聊天室")
dim ID
ID=trim(Request("ID"))
if ID="" or IsNumeric(ID)=false then
   Call Error("<p>错误的聊天室ID")
end if

dim acok,diser
acok  = trim(Request("acok"))
diser = trim(Request("diser"))

'主题
dim Title
if acok = "edit" then
  Title = trim(Request("Title"))
  Title = forbbs(Title)
  if len(Title) > 10 then
    Call Error("<p>聊天室主题最多10个字！")
  end if
end if

'数据库
dim Disallow,Disaller,n
set rs=server.CreateObject("ADODB.RecordSet")
rs.open "select roomAdmin,roomAdmin2,Chattxt,chathall,Title,gruid from Chat where ID="&ID,conn,1,2
if rs.eof then
   rs.close
   set rs=Nothing
   Call Error("<p>错误的聊天室ID")
end if

Disallow = rs("chathall")
roomAdmin2 = rs("roomAdmin2")

'管理员
dim AdminID
AdminID = 0
if Instr(","&rs("roomAdmin")&",",","&myid&",") > 0 then
   AdminID   = myid
end if
if rs("gruid")=adminzone then
else

if myid = AdminID or keys = 1 or keys=2 then
else
   rs.close
   set rs=Nothing
   Call Error("<p>您没有管理权限！")
end if
end if

if acok = "del" or acok = "deltxt" or acok = "edit" then
else

   Response.write "<p>执行管理"&chr(13)
   Response.write "<br/><a href=""chatadmin.asp?ID="&ID&"&amp;acok=deltxt&amp;sid="&sid&"&amp;saytk="&saytk&""">清空聊天</a>"&chr(13)
   Response.write "<br/><a href=""chatvice.asp?ID="&ID&"&amp;sid="&sid&"&amp;saytk="&saytk&""">修改主题</a>"&chr(13)
   if roomAdmin2<>0 then
      Response.write "<br/><a href=""chatmm.asp?ID="&ID&"&amp;sid="&sid&"&amp;saytk="&saytk&""">修改密码</a>"&chr(13)
      Response.write "<br/><a href=""chatdel.asp?ID="&ID&"&amp;sid="&sid&"&amp;saytk="&saytk&""">删除聊室</a>"&chr(13)
   end if
   Response.write "<br/>*踢出某ID"&chr(13)
if saytk<>1 then
Response.write "<form name=""form"" method=""post"" action=""chatOut.asp?sid="&sid&"&amp;saytk="&saytk&""">"
end if
   Response.write "<br/><input emptyok=""true"" name=""IDS""/>"&chr(13)
if saytk<>1 then
response.write "<input type=""hidden"" name=""tp"" value=""1""/>"
response.write "<input type=""submit"" name=""Submit"" value=""踢出""></form><br/>"
else
   Response.write "<br/><anchor>踢出"&chr(13)
   Response.write "<go href=""chatOut.asp?sid="&sid&"&amp;saytk="&saytk&""" method=""post"">"&chr(13)
   Response.write "<postfield name=""IDS""      value=""$(IDS)""/>"&chr(13)
   Response.write "<postfield name=""ID""      value="""&ID&"""/>"&chr(13)
   Response.write "</go></anchor>"&chr(13)
end if
    if Disallow <> "" then
      Disaller = split(Disallow,",")
      Response.write "<br/>&nbsp;"&chr(13)
      Response.write "<br/>*黑名单"&chr(13)
if saytk<>1 then
Response.write "<form name=""form"" method=""post"" action=""chatadmin.asp?ID="&ID&"&amp;acok=del&amp;sid="&sid&"&amp;saytk="&saytk&""">"
end if
      Response.write "<br/><select name=""Diser"">"&chr(13)
      Response.write "<option value=""0"">所有</option>"&chr(13)
      for n = 0 to ubound(Disaller)
        Response.write "<option value="""&Disaller(n)&""">"&Disaller(n)&"</option>"&chr(13)
      next
      Response.write "</select>"&chr(13)
if saytk<>1 then
response.write "<input type=""submit"" name=""Submit"" value=""清除""></form><br/>"
else
      Response.write "<br/><a href=""chatadmin.asp?ID="&ID&"&amp;acok=del&amp;diser=$(Diser)&amp;sid="&sid&"&amp;saytk="&saytk&""">清除</a>"&chr(13)
    end if
end if
   Response.write "<br/><a href=""chatroom.asp?ID="&ID&"&amp;sid="&sid&"&amp;saytk="&saytk&""">返回房间</a>"&chr(13)
call head1()
   rs.close
   set rs=Nothing
   conn.close
   set conn=Nothing
   Response.end
end if

if acok = "deltxt" then
  rs("Chattxt") = ""
elseif acok = "edit" then
  rs("Title") = Title
else
  '全部放
  if diser = "" or diser = "0" then
    rs("Chathall") = ""
  '放其中一个
  else
    Disallow       = ","&Disallow&","
    diser          = ","&diser&","
    Disallow       = Replace(Disallow,diser,",")
    Disallow       = Replace(Disallow,","," ")
    Disallow       = trim(Disallow)
    Disallow       = Replace(Disallow," ",",")
    rs("Chathall") = Disallow
  end if
end if
rs.update

rs.close
set rs=nothing
conn.close
set conn=Nothing

response.write "<onevent type=""ontimer"">"&chr(13)
response.write "<go href=""chatroom.asp?ID="&ID&"&amp;sid="&sid&"&amp;saytk="&saytk&"""/>"&chr(13)
response.write "</onevent>"&chr(13)
response.write "<timer value=""10""/>"&chr(13)

Response.write "<p>管理成功！"&chr(13)
Response.write "<br/><a href=""chatroom.asp?ID="&ID&"&amp;sid="&sid&"&amp;saytk="&saytk&""">返回房间</a>"&chr(13)
call head1()
%>