<!--#include file="../Include/Const.asp" -->
<!--#include file="../Include/Conn.asp" -->
<!--#Include File="Func.asp"-->
<%Response.Charset="gb2312"%>
<%
  Call WebSiteLoad(1)
  dim LoginName,Email,UserName,VerifyCode,Title,Phone,Message,TQQ,rs,sql
  LoginName=trim(session("UserName"))
  VerifyCode = trim(request("txtCode"))
  Title = trim(request("txtTitle"))
  Message = trim(request("txtContent"))
  UserName = trim(request("txtUserName"))
  Phone = trim(request("txtUserTel"))
  TQQ = trim(request("txtUserQQ"))
  EMail = trim(request("txtUserEmail"))

   if CStr(Session("GetCode"))<>CStr(VerifyCode) then
   response.write("{""status"": 0, ""msg"": ""您输入的验"&VerifyCode&"证码错误，请返回重新输入！""}")
   response.end
   end If

   If Message="" Then 
   response.write("{""status"": 0, ""msg"": ""请输入留言内容！""}")
   response.end
   End If 

   Dim Userid
   set rsu = server.createobject("adodb.recordset")
   sqlu="select * from Angel_User where UserName='"&LoginName&"'"
   rsu.open sqlu,conn,1,1
   if rsu.bof and rsu.eof Then
   else
   Userid=rsu("ID")
   End If 
   rsu.close
   set rsu=Nothing
   
   set rs = server.createobject("adodb.recordset")
   sql="select * from Angel_Message "
   rs.open sql,conn,3,3
   rs.addnew()
   rs("Title")=Title
   rs("username")=UserName
   rs("Company")=SiteTitle2
   If Userid<>"" Then
   rs("UserID") = Userid
   Else 
   rs("UserID") = 0
   End If 
   rs("Mobile")=Phone
   rs("Phone")=Phone
   rs("Email")=EMail
   rs("Hidden")=-1
   rs("message")=Message
   rs("QQ")= TQQ
   rs("AddDate")=now()
   rs.update
   rs.close
   set ors=nothing
   response.write("{""status"": 1, ""msg"": ""留言成功！"", ""url"": ""messagewrite.asp""}")
   response.End
   
%>