<!--#include file="inc_const.asp"-->
<%response.expires=0
Response.CacheControl = "Private"
application.lock
set cschat=server.createobject("ffcschat.cssbchat")

my_level=cschat.getLevel(Session,Application(ConstStr & "_user_list"),Application(ConstStr & "_room_list"))
room_id=cschat.room_id
myname=cschat.myname

if my_level=0 then
  errtext="你还没有登录到聊天室！"
else
  cschat.FilterStr = Application(ConstStr & "_saysfilterstr")
  room_array=split(Application(ConstStr & "_room_list"),"<$"&room_id&"$>")
  room_array2=split(room_array(1),"$>")
  room_name=room_array2(0)

  if lcase(myname)=lcase(room_array2(1)) and my_level-application(ConstStr & "_l_kick")<0 then my_level=application(ConstStr & "_l_kick")
  votes=application(ConstStr & "_votes")
  if (votes(0)<>0 and votes(1)=myname) then my_level=1

  cmdYes=request("cmdYes")
  if cmdYes<>"踢人" and cmdYes<>"封IP" then
    errtext="你要进行什么操作？！"
  elseif (cmdYes="踢人" and my_level-application(ConstStr & "_l_kick")<0) or (cmdYes="封IP" and my_level-application(ConstStr & "_l_lockip")<0) then
    errtext="你暂时还没有["&cmdYes&"]权力！"
  else
    selwho=request("selwho")
    if instr(" "&room_array2(12)&" "," "&selwho&" ")=0 then
      errtext="["&selwho&"]不在当前聊天室里了！"
    else
      sel_user_array=split(Application(ConstStr & "_user_list"),"<$"&selwho&"$>")
      sel_user_array2=split(sel_user_array(1),"$>")

      if (my_level-sel_user_array2(8))<1 then
        errtext="聊天室不允许对高级或同级聊友行使管理权限！"
      elseif lcase(selwho)=lcase(room_array2(1)) then
        errtext="人家是房主，不能如此对待人家！"
      elseif lcase(selwho)=lcase(myname) then
        errText="您想处罚自己吗？请自杀吧！"
      else
        forwhat=left(cschat.trdb(request("forwhat")),40)
        if forwhat="" then
          errtext="不注明原因，你想乱来啊？"
        end if
      end if
    end if
  end if
end if
if errtext<>"" then%>
  <script>if (parent.input) alert('<%=errText%>');else window.open('showerr.asp?errtext=<%=errText%>','_self');</script>
  <%application.unlock
  response.end
end if

if my_level-application(ConstStr & "_superlevel")=0 then myname="管理员"

Set Conn=Server.CreateObject("ADODB.Connection")
conn.open Application(ConstStr & "_connstr")

sql="SELECT out_info,out_time FROM user WHERE username='" & selwho & "'"
set Rs=conn.Execute(sql)

if not (Rs.eof or Rs.bof) then
  stype=1
  occ_end=">把%%请出了聊天室"
  say_mess=split(application(ConstStr & "_kickshow"),"::")
  out_time=dateAdd("n",application(ConstStr & "_kicknamedontlogin"),now())
  if cmdYes="封IP" then
    stype=2
    occ_end=">封锁了%%的IP"
    say_mess=split(application(ConstStr & "_lockuseripshow"),"::")
    say_mess(0)=replace(say_mess(0),"$IP",sel_user_array2(1))
    out_time=dateAdd("n",application(ConstStr & "_iplocktime"),now())
    conn.Execute("DELETE FROM ip_lock WHERE ip='"&sel_user_array2(1)&"'")
    conn.Execute("INSERT INTO ip_lock (ip,end_time,act_level) VALUES ('"&sel_user_array2(1)&"','"&out_time&"',"&my_level&")")
  end if
  conn.Execute("UPDATE user SET out_info=5,out_time='"&out_time&"',room_id=0 WHERE username='"&selwho&"'")
  occ_env=room_name&">"&myname&">"&Request.ServerVariables("REMOTE_ADDR")&">"&selwho&">"&sel_user_array2(1)&">"&forwhat&occ_end
  conn.Execute("INSERT INTO record (stype,occ_time,occ_env) VALUES ("&stype&",'"&now()&"','"&occ_env&"')")

  say_mess(0)=replace(say_mess(0),"$F",forwhat)
  say_mess(0)=say_mess(0)&"<\script>parent.dell(\'" & selwho & "\')</\script>"
  says = Application(ConstStr & "_says")
  current = Application(ConstStr & "_current")
  cschat.newsay myname,selwho,0,room_id,say_mess(0),say_mess(1),say_mess(2),-2,says,current
  Application(ConstStr & "_says") = says
  Application(ConstStr & "_current") = current

end if

application(ConstStr & "_user_list")=sel_user_array(0)&sel_user_array(2)
room_array2(12)=trim(replace(" "&room_array2(12)&" "," "&selwho&" "," "))
room_array(1)=join(room_array2,"$>")
Application(ConstStr & "_room_list")=join(room_array,"<$"&room_id&"$>")

set cschat=nothing
application.unlock
rs.close
set rs=nothing
conn.close
set conn=nothing
errtext="你成功地处罚了<font color=green>"&selwho&"</font>!"
%>
<script>if (!parent.input) window.open('showerr.asp?errtext=<%=errText%>','_self');</script>