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

dim TP
TP  = trim(Request("TP"))

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

Disallow = rs("chathall")
'管理员
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("您没有管理权限！")
end if
end if
if TP="" then
   Response.write ""&chr(13)
   Response.write "*主题(15字内)"&chr(13)
if saytk<>1 then
Response.write "<form name=""form"" method=""post"" action=""chatvice.asp?sid="&sid&"&amp;saytk="&saytk&""">"
end if
if saytk<>1 then
   Response.write "<br/><input emptyok=""true"" name=""Title"" value="""&rs("title")&"""/>"&chr(13)
else
   Response.write "<br/><input emptyok=""true"" name=""Title"&tt&""" value="""&rs("title")&"""/>"&chr(13)
end if
   Response.write"<br/>管理ID(多个用,分开)<br/>"
if saytk<>1 then
   Response.write"<input name='ids' value='"&rs("roomAdmin")&"'/><br/>"
else
   Response.write"<input name='ids"&tt&"' value='"&rs("roomAdmin")&"'/><br/>"
end if
if saytk<>1 then
response.write "<input type=""hidden"" name=""ID"" value="""&ID&"""/>"
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=""chatvice.asp?sid="&sid&"&amp;saytk="&saytk&""" method=""post"">"&chr(13)
   Response.write "<postfield name=""ID""      value="""&ID&"""/>"&chr(13)
   Response.write "<postfield name=""TP""    value=""1""/>"&chr(13)
   Response.write "<postfield name=""Title"" value=""$(Title"&tt&")""/>"&chr(13)
   Response.write"<postfield name='ids' value='$(ids"&tt&")'/>"
   Response.write "</go></anchor>"&chr(13)
end if
   Response.write "<br/><a href=""chatroom.asp?ID="&ID&"&amp;sid="&sid&"&amp;saytk="&saytk&""">返回房间</a>"&chr(13)
call head1()
else
'主题
dim Title
  Title = trim(Request("Title"))
  ids=trim(request("ids"))
  Title = forbbs(Title)
  if len(Title) > 15 then
    Call Error("聊天室主题最多15个字！")
  end if
if ids="" then
    Call Error("<p>管理员不能空缺！")
  end if
  ids=replace(ids,"，",",")
rs("roomadmin")=ids
  rs("Title") = Title
rs.update
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 "管理成功！"&chr(13)
Response.write "<br/><a href=""chatroom.asp?ID="&ID&"&amp;sid="&sid&"&amp;saytk="&saytk&""">返回房间</a>"&chr(13)
call head1()
end if
rs.close
set rs=nothing
conn.close
set conn=Nothing
%>