﻿<!--#include file="../Inc.asp"-->
<!--#include file="../ydzq.asp"-->
<!--#include file="../forbbs.asp"-->
<%Call FortxtChat
Response.write "<card title=""踢出聊天室"">"&chr(13)

dim ID,IDS
ID  = trim(Request("ID"))
IDS = trim(Request("IDS"))

if ID="" or IsNumeric(ID)=false then
   Call Error("<p>不存在的聊天室！")
end if

if IDS="" or IsNumeric(IDS)=false then
   Call Error("<p>错误的会员ID！")
end if
IDS = abs(IDS)

if IDs = myid then
  Call Error("<p>不能踢自己！")
end if

dim userkey
set rs=server.createobject("ADODB.Recordset")
rs.Open "select keys from Users where ID = "&IDS,conn,1,1
if not rs.eof then
userkey=rs("keys")
end if
rs.close
set rs=nothing

if userkey = 1 then
  Call Error("<p>你想踢管理员？")
end if
dim acok
acok = trim(Request.QueryString("acok"))

if acok <> "ok" then
   conn.close
   set conn=Nothing
   Response.write "<p>确定把ID"&IDs&"踢出？"
   Response.write "<br/><a href='chatOUT.asp?ID="&ID&"&amp;IDS="&IDS&"&amp;acok=ok&amp;sid="&sid&"'>确定</a>"
   Response.write "<br/><anchor><prev/>取消</anchor>"
   Response.write "</p></card></wml>"
   Response.end
end if

set rs=server.createobject("adodb.recordset")
rs.open "select roomAdmin,Chathall,gruid from Chat where ID="&ID,conn,1,2
if rs.eof then
  rs.close
  set rs=nothing
  Call Error("<p>不存在的聊天室！")
end if

'管理员
dim AdminID
AdminID = 0
if Instr(","&rs("roomadmin")&",",","&myid&",") > 0 then
   AdminID   = myid
end if
if abs(gruid)=adminzone then
else
if myid = AdminID or keys = 1 then
else
   rs.close
   set rs=Nothing
   Call Error("<p>您没有管理权限！")
end if
end if
if Instr(","&rs("chathall")&",",","&IDS&",") = 0 then
  if rs("chathall") <> "" then
   rs("chathall") = rs("chathall")&","&IDS
  else
   rs("chathall") = IDS
  end if
  rs.update
end if
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&"""/>"&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&"'>返回房间</a>"&chr(13)
Response.write "</p></card></wml>"
%>