<!--#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

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

if my_level=0 then
  errtext="你还没有登录到聊天室！"
else
  votes=application(ConstStr & "_votes")
  if (votes(0)<>0 and votes(1)=myname) then my_level=1
  cmdYes=request("cmdYes")
  if cmdYes<>"冻结用户" and cmdYes<>"永久冻结" then
    errtext="你要进行什么操作？！"
  elseif my_level-application(ConstStr & "_l_lockuser")<0 or (cmdYes="永久冻结" and my_level-application(ConstStr & "_l_colduser")<0) or (my_level-towho_level)<1 then
    errText="你暂时还没有"&cmdYes&"权力！"
  else
    selwho=request("selwho")
    set rs=conn.execute("SELECT * FROM user WHERE username='" & selwho & "'")
    if rs.eof or rs.bof then
      errText="查无此人：<font color=green>"&selwho&"</font>！"
    else
      selwho=rs("username")
      ipstr=rs("last_ip")
      towho_level=rs("user_level")
      cschat.FilterStr = Application(ConstStr & "_saysfilterstr")
      forwhat=left(cschat.trdb(request("forwhat")),40)
      if selwho=myname then
        errText="您想处罚自己吗？请自杀吧！"
      elseif forwhat="" then
        errText="不注明原因，你想乱来啊？"
      elseif my_level-towho_level<=0 then
        errtext="聊天室不允许对高级或同级聊友行使管理权限！"
      end if
    end if
    rs.close
  end if
end if
if errtext<>"" then%>
  <script>if (parent.input) alert('<%=errText%>');else window.open('showerr.asp?errtext=<%=errText%>','_self');</script>
  <%application.unlock
  set cschat=nothing
  response.end
end if

if my_level-application(ConstStr & "_superlevel")=0 then myname="管理员"
room_name=cschat.GetListValue(Application(ConstStr & "_room_list"), room_id, 0)

says = Application(ConstStr & "_says")
current = Application(ConstStr & "_current")

if instr(Application(ConstStr & "_user_list"),"<$"&selwho&"$>")<>0 then
  sel_room_id=cschat.GetListValue(Application(ConstStr & "_user_list"), selwho, 4)
  Application( ConstStr & "_room_list")=cschat.SetListValue(Application( ConstStr & "_room_list"), sel_room_id, 12, selwho, -1)
  cschat.newsay selwho,"",0,sel_room_id,"<\script>parent.dell(\'" & selwho & "\')</\script>","","",-5,says,current
  application(ConstStr & "_user_list")=cschat.DelList(application(ConstStr & "_user_list"),selwho)
end if

if cmdYes="冻结用户" then
  stype=4
  occ_end=">冻结用户%%的帐号"
  out_info=6
else
  stype=5
  occ_end=">永久冻结用户%%的帐号"
  out_info=7
end if

out_time=dateAdd("n",60,now())
conn.Execute("UPDATE user SET out_info="&out_info&",out_time='"&out_time&"',room_id=0 WHERE username='"&selwho&"'")
occ_env=room_name&">"&myname&">"&Request.ServerVariables("REMOTE_ADDR")&">"&selwho&">"&ipstr&">"&forwhat&occ_end
conn.Execute("INSERT INTO record (stype,occ_time,occ_env) VALUES ("&stype&",'"&now()&"','"&occ_env&"')")

say_mess=split(application(ConstStr & "_coldusershow"),"::")
say_mess(0)=replace(say_mess(0),"$F",forwhat)
say_mess(0)=replace(say_mess(0),"$OP",cmdYes)
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

set cschat=nothing
application.unlock
set rs=nothing
conn.close
set conn=nothing

errText="你成功地"&cmdYes&"<font color=green>"&selwho&"</font>的帐号!"
response.redirect "showerr.asp?errtext="&errText%>
