<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../Inc/Conn.asp" -->
<%
Action=Replace(Trim(Request.QueryString("Action")),"'","")
If Action="ok" then
   Title   =Replace(Trim(Request.Form("Title")),"'","")
   UserName=Replace(Trim(Request.Form("UserName")),"'","")
   Tel     =Replace(Trim(Request.Form("Tel")),"'","")
   QQ      =Replace(Trim(Request.Form("QQ")),"'","")
   Content =Replace(Trim(Request.Form("Content")),"'","")
   If Title="" or len(Title)>50 then
      Response.Write("<script language='javascript'>alert('对不起，请输入留言主题！');history.back();</script>")
	  Response.End()
   end if	  
   If Tel="" or len(Tel)>50 then
      Response.Write("<script language='javascript'>alert('对不起，请输入联系方式！');history.back();</script>")
	  Response.End()
   end if
   If Content="" or len(Content)>200 then
      Response.Write("<script language='javascript'>alert('对不起，请输入留言内容！');history.back();</script>")
	  Response.End()
   end if
   if instr(Content,"sb")>0 or instr(Content,"www")>0 or instr(Content,"http")>0 or instr(Content,"href")>0 or instr(Content,"com")>0 then
      Response.Write("<script language='javascript'>alert('对不起，留言内容不合法！');history.back();</script>")
	  Response.End()
end if

   set rs=server.createobject("Adodb.recordset")
   rs.open"select * from Message where ID is null",conn,1,3
   rs.addnew
      rs("title")=Title
	  rs("UserName")=UserName
	  rs("Tel")=Tel
	  rs("QQ")=QQ
	  rs("Content")=Content
	  rs("AddTime")=now()
   rs.update
   rs.close:set rs=nothing
   conn.close:set conn=nothing
   response.write("<script language='javascript'>alert('留言成功!');location.href='index.html';</script>")
   Response.End()
End If
%>
