<%@ LANGUAGE=VBScript CodePage=65001%>
<% response.charset="utf-8" %>
<% session.codepage=65001 %>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- #include file="AntiAttack.asp" -->
<!-- #include file="conn.asp" -->
<!-- #include file="md5.asp" -->
<!-- #include file="html_clear.asp" -->
<!-- #include file="rand.asp" -->
<!-- #include file="web_config.asp" -->

<%'判断
if request("act")="add" then

article_id=request("id")
name1=nohtml(trim(request.form("PetName")))
email1=nohtml(trim(request.form("PetEmail")))
tel1=nohtml(trim(request.form("PetTel")))
title1=nohtml(trim(request.form("PetTitle")))
content1=nohtml(trim(request.form("PetContent")))
cid1=nohtml(trim(request.form("PetCid")))
pid1=nohtml(trim(request.form("PetPid")))
input_code=trim(request.form("verycode"))
ip1=Request.serverVariables("REMOTE_ADDR")

if name1="" Or title1="" Or content1="" then
response.Write "<script language='javascript'>alert('请输入必填内容！');history.go(-1)</script>"
else

    if request("verycode")="" then
    response.write "<script language=javascript>alert('您输入的验证码有误^_^');history.go(-1);</script>"
  	Response.End 
	elseif session("getcode")="9999" then
    session("getcode")=""
	elseif session("getcode")="" then
    response.write "<script language=javascript>alert('您输入的验证码有误^_^');history.go(-1);</script>"
 	Response.End 
	elseif cstr(session("getcode"))<>cstr(trim(request("verycode"))) then
    response.write "<script language=javascript>alert('您输入的验证码有误^_^');history.go(-1);</script>"
	Response.End 
	end if

' 发布
set rs=server.createobject("adodb.recordset")
sql="select * from web_info where [content]='"&nohtml(content1)&"' and [PetName]='"&nohtml(name1)&"'  and [Title]='"&nohtml(title1)&"'   "
rs.open(sql),cn,1,3
if not rs.eof then  
response.Write "<script language='javascript'>alert('请不要重复发布！');history.go(-1)</script>"
else
rs.addnew

rs("PetID")="GPF"&Year(Now())&month(Now())&a7
rs("File_Path")=a7&minute(now)&second(now)&".html"
rs("PetName")=nohtml(name1)
rs("PetEmail")=nohtml(email1)
rs("PetTel")=nohtml(tel1)
rs("title")=nohtml(title1)
rs("content")=nohtml(content1)
rs("cid")=nohtml(cid1)
rs("pid")=nohtml(pid1)
rs("ip")=ip1
rs("time")=now()
if MessageCheck=0 then
rs("view_yes")=0
else
rs("view_yes")=1
end if
rs.update
rs.close
set rs=nothing

'Mail System Check Start
if ReceiveMessageYes=1 then
''=========利用Jmail在线发送邮件函数 start=============
Function sendjmail(t1,t2,t3)
't1:接收邮件地址 t2:接收邮件用户名 t3:邮件正文
dim jmail
set jmail=server.createobject("Jmail.message")
jmail.silent=true
jmail.charset="gb2312"
jmail.ContentType = "text/html"

'发件人邮箱
jmail.from=MailAddress
'发件人名称
jmail.fromname=MailSentName
'收件人邮箱,姓名  
jmail.AddRecipient t1,t2
'邮件的紧急程度，1最快，5最慢
jmail.Priority=MailEmergency
'发送邮件标题
jmail.subject=name1&" 在 "&web_name&" 上发表了新留言"
'指定别的回信地址   
JMail.ReplyTo=MailAddress

JMail.HTMLBody = "<html><head><meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312""><style type=text/css>A:link { FONT-SIZE: 10pt; TEXT-DECORATION: none; color: #000000}A:visited {FONT-SIZE: 10pt; TEXT-DECORATION: none; color: #666666}A:hover {COLOR: #ff6600; FONT-SIZE:14pt; TEXT-DECORATION: underline}BODY {FONT-SIZE: 9pt} --></style></head><body><br>"&t3&"</body></html>"

jmail.mailserverusername=MailName       '邮件发送服务器登录名称
jmail.mailserverpassword=MailPassword       '邮件发送服务器登录密码
sendok=jmail.send(MailSmtp)         'smtp服务器名称

if sendok then
'response.write "恭喜您，"&t1&"邮件发送成功！"&NOW()
else
'response.write "对不起，邮件发送失败，可能由于服务器登录设置不当或信息有误！"&NOW()
end if

jmail.Close
set jmail=nothing
End Function
''=========利用Jmail在线发送邮件函数 end=============

''调用上面定义的函数发送邮件的方法
MailDetails=MailDetails&"<table cellpadding='0' cellspacing='0' width='700' align='center' style='font-family:Microsoft Yahei,Verdana,Arial;'>"
MailDetails=MailDetails&"<tr>"
MailDetails=MailDetails&"<td style='background:#4169E1;line-height:45px;font-size:16px;font-weight:bold;color:#FFFFFF;font-family:'黑体';'>&nbsp;&nbsp;"&web_name&" -- GovPet Mail System </td>"
MailDetails=MailDetails&"</tr>"
MailDetails=MailDetails&"<tr>"
MailDetails=MailDetails&"<td style='border:#CCCCCC 1px solid;padding:20px 20px 20px 20px;line-height:180%;font-size:13px;'>"
MailDetails=MailDetails&"<strong>您好,"&name1&" 在网站上有新留言：</strong><br />"
MailDetails=MailDetails&"<br />"
MailDetails=MailDetails&"<strong>姓名：</strong>"&name1&"<br />"
MailDetails=MailDetails&"<strong>IP：</strong>"&ip1&"<br />"
MailDetails=MailDetails&"<strong>电子邮件：</strong>"&email1&"<br />"
MailDetails=MailDetails&"<strong>联系电话：</strong>"&tel1&"<br />"
MailDetails=MailDetails&"<strong>咨询主题：</strong>"&title1&"<br />"
MailDetails=MailDetails&"<strong>咨询内容：</strong>"&content1&"<br />"
MailDetails=MailDetails&"请登录 <a href='"&web_url&"' target='_blank'>"&web_url&"</a>查看相关信息，及时与其取得联系。<br />"
MailDetails=MailDetails&"</td>"
MailDetails=MailDetails&"</tr>"
MailDetails=MailDetails&"<tr>"
MailDetails=MailDetails&"<td style='background:#333333;padding:10px;line-height:180%;font-size:12px;color:#FFFFFF;'>请注意：此邮件系 <a href='"&web_url&"' target='_blank' style='color:#FFFFFF;'>"&web_name&"</a> 自动发送，请勿直接回复。<br>如果此邮件不是您请求的，请忽略并删除！</td>"
MailDetails=MailDetails&"</tr>"
MailDetails=MailDetails&"</tr>"
MailDetails=MailDetails&"<tr>"
MailDetails=MailDetails&"<td style='background:#333333;padding:5px;line-height:180%;font-size:10px;color:#494949;'>Powered By <a href='http://www.GovPet.com/' target='_blank' style='color:#494949;'>GovPet Mail System</a> All Rights Reserved</td>"
MailDetails=MailDetails&"</tr>"
MailDetails=MailDetails&"</table>"

response.write sendjmail(ReceiveMailAddress,MailName,MailDetails)
end if
'GovPetCMS Mail System Check End

	response.write"<SCRIPT language=JavaScript>alert('提交成功，请耐心等候处理^_^');"
  response.write"location.href='/';</SCRIPT>"
end if


end if
end if
%>