<!--#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
  dim say_mess
  say_mess=Array("","","")
  Set Conn=Server.CreateObject("ADODB.Connection")
  conn.open Application(ConstStr & "_connstr")

  sql="SELECT out_info,out_time FROM user WHERE username='" & myname & "'"
  set Rs=conn.Execute(sql)
  if not (Rs.eof or Rs.bof) then
    if datediff("n",cschat.getListvalue(Application( ConstStr & "_user_list"),myname,11),now())-application(ConstStr & "_dontsavevalue")>0 then
      say_mess=split(application(ConstStr & "_clearexpoutshow"),"::")
      errText="你长时间不存点，被自动清除！"
      outinfo=4
    elseif datediff("n",cschat.getListvalue(Application( ConstStr & "_user_list"),myname,10),now())-application(ConstStr & "_nosaytimeout")>0 then
      say_mess=split(application(ConstStr & "_nosaytimeoutshow"),"::")
      errText="你长时间不说话，沉入海底了！"
      out_info=3
    else
      say_mess=split(application(ConstStr & "_unknowerrorexitshow"),"::")
      errText="异常退出，请删除浏览器的临时文件再试！"
      out_info=2
    end if
    conn.Execute("UPDATE user SET out_time='"&now()&"',out_info="&out_info&",room_id=0 WHERE username='"&myname&"'")
  else
    errText="你还没有进入到聊天室！"
  end if
  say_mess(0)=say_mess(0) & "<\script>parent.dell(\'" & myname & "\')</\script>"
  says = Application(ConstStr & "_says")
  current = Application(ConstStr & "_current") 
  cschat.newsay myname,"大家",0,room_id,say_mess(0),say_mess(1),say_mess(2),-2,says,current
  Application(ConstStr & "_says") = says
  Application(ConstStr & "_current") = current
  application(ConstStr & "_user_list")=cschat.DelList(application(ConstStr & "_user_list"),myname)
  Application( ConstStr & "_room_list")=cschat.SetListValue(Application( ConstStr & "_room_list"), room_id, 12, myname, -1)
 
  rs.close
  set rs=nothing
  application.unlock
  Session.Abandon
  Session("Leave")=true
  conn.close
  set conn=nothing
end if
set cschat=nothing
application.unlock
response.redirect("showerr.asp?errtext="&errText)%>
