<!--#include file="inc_const.asp"-->
<%response.expires=0

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
errText=""
answers=Application( ConstStr & "_answers")
if answers(0)=0 then
 errText="答题活动已经结束！"
else
  submitanswer=trim(request("answer"))
  says = Application(ConstStr & "_says")
  current = Application(ConstStr & "_current")
  if trim(answers(3))=submitanswer then
    answers(0)=0
    answers(5)=now()
    say_mess=split(application(ConstStr & "_answersuccessshow"),"::")
    say_mess(0)=replace(replace(replace(replace(say_mess(0),"$Q",answers(2)) ,"$T",answers(1)),"$A",submitanswer),"$N",answers(4))
    cschat.newsay Application( ConstStr & "_questionautoman"),myname,0,answers(7),say_mess(0),say_mess(1),say_mess(2),-2,says,current
    Set Conn=Server.CreateObject("ADODB.Connection")
    conn.open Application( ConstStr & "_connstr")
    conn.Execute("UPDATE user SET exp_num=exp_num+"&answers(4)&" WHERE username='"&myname&"'")
    conn.close
    set conn=nothing
    Application( ConstStr & "_answers")=answers
  elseif application(ConstStr & "_showloseanswer")="1" then
    say_mess=split(application(ConstStr & "_questionloseshow"),"::")
    say_mess(0)=replace(replace(replace(say_mess(0),"$Q",answers(2)) ,"$T",answers(1)),"$A",submitanswer)
    cschat.newsay Application( ConstStr & "_questionautoman"),myname,0,answers(7),say_mess(0),say_mess(1),say_mess(2),-2,says,current
  else
    errText="您的答案是错误的！呵呵！继续努力哟！"
  end if
  Application(ConstStr & "_says") = says
  Application(ConstStr & "_current") = current
end if
if errText<>"" then
  errText="-1,'##:"&errText&"','"&Application(ConstStr & "_questionautoman")&"','"&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.input.nosavetime=0;parent.addsay(<%=errText%>);</script>
<%end if
set cschat=nothing
application.unlock
%>