<!--#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-application( ConstStr & "_l_vote")<0 then
  response.redirect("showerr.asp?errtext=你的级别太低了！")
  set cschat=nothing
  application.unlock
  response.end
end if

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

act=request("act")

if act<>"终止" and act<>"删除" then
  errstr="你想进行什么操作？"
else
  Set Conn=Server.CreateObject("ADODB.Connection") 
  conn.open Application( ConstStr & "_connstr")
  votename=request("name")
  set rs=conn.execute("select * from vote where votename='"&votename&"' and exp_num<>1")
  if rs.bof or rs.eof then
    errstr="你所选取的投票事件不存在！"
  else
    if act="终止" then
      stype=8
      occ_end="终止投票事件%%"
      conn.execute("UPDATE vote SET end_flag='"&now()&"' WHERE votename='"&votename&"' and exp_num<>1")
    else
      stype=9
      occ_end="删除投票事件%%"
      conn.execute("delete from vote WHERE votename='"&votename&"'")
    end if
    errstr="你成功地"&act&"了投票事件〖"&votename&"〗！"
    occ_env=room_name&">"&myname&">"&Request.ServerVariables("REMOTE_ADDR")&">"&votename&"> >此处只作记录>"&occ_end
    conn.Execute("INSERT INTO record (stype,occ_time,occ_env) VALUES ("&stype&",'"&now()&"','"&occ_env&"')")
  end if
  rs.close
  set rs=nothing
  conn.close
  set conn=nothing
end if
response.redirect("showerr.asp?errtext="&errstr)%>