<!--#include file="cf.asp"-->
<%
Session("cfxybbsusername")=request.cookies("username")&Application("username"&forum_sn)

if Session("cfxybbsusername")="" then
      response.write "<html><script>alert(""客人无权说话，请先登陆或者注册！"");parent.cfsend.location=(""" & "cfsend.asp?message=" & message & """)</script></html>"
     response.end
end if


if request("message")<>"" then
  dim message,i,msgs,newmsgs
  message=CovHtml(request("message"))
    if DateDiff("s",Session("lsmt"),now())>=5 then
      Application.lock
      msgs=Application("messagecfxybbs")
      msgs=split(msgs,vbcrlf)
	  if ubound(msgs)<=30 then
	      si=ubound(msgs)
	  else
	      si=30
	  end if
        for i=si to 0 step -1 
          if i>ubound(msgs) then
            exit for
          end if
            newmsgs=msgs(i)&vbcrlf&newmsgs
       next
      Application("messagecfxybbs")="["&time&"]"&"<font color='red'>"&Session("cfxybbsusername")&"</font>"&":"&message&"      <br>"&vbcrlf&newmsgs
      Application.unlock
       Session("lsmt")=now
      response.write "<html><script>parent.cfshow.location.href='cfshow.asp';parent.cfsend.location=(""" & "cfsend.asp?message="")</script></html>"
else
      response.write "<html><script>alert(""离下次发言还有" & 5-DateDiff("s",Session("lsmt"),now()) & "秒"");parent.cfsend.location=(""" & "cfsend.asp?message=" & message & """)</script></html>"
      response.end
    end if
end if

if request("message")="" and guanlicheck(session("cfxybbsusername")) then
 Application("messagecfxybbs")=""
end if

function CovHtml(content)
ON ERROR RESUME NEXT
CovHtml=content
if not isnull(content) then
CovHtml=replace(CovHtml,"&","&amp;")
CovHtml=replace(CovHtml,"<","&lt;")
CovHtml=replace(CovHtml,">","&gt;")
CovHtml=replace(CovHtml,chr(34),"&quot;")
CovHtml=replace(CovHtml,chr(39),"&#39;")
end if
if Err.Number <>0 then
CovHtml= "CovHtml转换中出错！<br>"
Err.Clear
end if
end function
%>