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

if my_level=0 then
  set cschat=nothing
  application.unlock
  response.end
end if
myname=cschat.myname
my_ip=Request.ServerVariables("REMOTE_ADDR")

votes=application( ConstStr & "_votes")
all_user_array=split(Application( ConstStr & "_user_list"),"$><$")
user_num=(UBound(all_user_array)+1)\2

votetype=cint(request("type"))

errText=""

if Application( ConstStr & "_disablevotekick")-1=0 then
  errText="【系统】管理员禁止提议！"
elseif my_level-Application( ConstStr & "_l_voteonline")<0 then
  errText="【系统】你的级别不够，不能提议！"
elseif votes(0)=0 then
  mess=""
  if user_num<5 then
    errText="【系统】现在在线人数太少了。不能提议！"
  elseif votetype<>3  then
    errText="【系统】对不起，你的提议类型无法判断！"
  else
    who=request("who")
    cschat.FilterStr = Application(ConstStr & "_saysfilterstr")
    forwhat=left(cschat.trdb(request("forwhat")),40)
    if forwhat="" then
      errText="【系统】不注明原因，你想乱来啊？"
    else
      votes(8)=forwhat
      if instr(Application( ConstStr & "_user_list"),"<$"&who&"$>")<>0 and who<>votes(1) and who<>myname then
        user_array=split(Application( ConstStr & "_user_list"),"<$"&who&"$>")
        user_array2=split(user_array(1),"$>")
        if user_array2(3)-application( ConstStr & "_superlevel")=0 then
          nowho=true
        else
          nowho=false
          votes(7)=user_array2(1)
        end if
      else
        nowho=true
      end if
      if nowho then
        errText="【系统】你的提议无效，可能原因：对象不在、连续提议、对方是斑竹！"
      else
        Set Conn=Server.CreateObject("ADODB.Connection")
        conn.open Application( ConstStr & "_connstr")
        stype=51
        occ_end=">提议把%%请出聊天室"
        votes(0)=3
        occ_env="在线提议>"&myname&">"&my_ip&">"&who&">"&votes(7)&">"&votes(8)&occ_end
        conn.Execute("INSERT INTO record (stype,occ_time,occ_env) VALUES ("&stype&",'"&now()&"','"&occ_env&"')")
        mess="【提议】有人以理由〖<font color=red>"&votes(8)&"</font>〗提议把<u>"&who&"</u>请出聊天室！请你点击：[<a href=voteput.asp?agree=1 onclick=\'parent.input.document.forms[0].saystemp.focus()\' target=newsay>同意</a>]，[<a onclick=\'parent.input.document.forms[0].saystemp.focus()\' href=voteput.asp?agree=0 target=newsay>不同意</a>]？"
        votes(1)=who

        for i=0 to UBound(all_user_array) step 2
        all_user_array2=split(all_user_array(i),"$>")
        user_name=replace(all_user_array2(0),"<$","")
        if user_name<>who and user_name<>myname then
          all_user_array2(8)=1
        else
          all_user_array2(8)=0
        end if
        all_user_array(i)=join(all_user_array2,"$>")
        next
        Application( ConstStr & "_user_list")=join(all_user_array,"$><$")

        votes(2)=1
        votes(3)=0
        votes(4)=user_num
        votes(5)=now()
        votes(6)=true
        votes(9)=myname
        application( ConstStr & "_votes")=votes
says = Application(ConstStr & "_says")
current = Application(ConstStr & "_current")
        cschat.newsay "大家","大家",0,-2,mess,"green","red",-4,says,current
Application(ConstStr & "_says") = says
Application(ConstStr & "_current") = current
        conn.close
        set conn=nothing
      end if
    end if 
  end if
end if
application.unlock
if errText<>"" then
 errText="-1,'"&errText&"','大家','"&myname&"',0,'996633','990099',-2,'"&cschat.gettimestr()&"'"%>
 <meta HTTP-EQUIV='Pragma' CONTENT='no-cache'><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><SCRIPT language=JavaScript>parent.addsay(<%=errText%>);</script>
<%end if
set cschat=nothing
%>