<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<!-- #include file="../inc/defendsql.asp" -->
<!-- #include file="../inc/conn.asp" -->
<!-- #include file="../inc/Nohtml.asp" -->
<!-- #include file="../inc/External.asp" -->

<%
if trim(session("validateCode")) <> trim(Request("txt_check")) then
ErrorMessage = "亲爱的，请输入正确的验证码哦？"
response.write(" <script>alert('"&ErrorMessage&"');history.go(-1);</script>")
response.end
end if
%>

<%
post_id=request.form("post_id")

u_name=request.form("u_name")
us_url=request.form("u_url")
u_mail=request.form("u_mail")
u_con=request.form("u_content")

u_content=RemoveHTML(""&u_con&"",1000)
jizhu=request.form("jizhu")
huifu=request.form("huifu")

if u_name="" then
response.write "<Script language=JavaScript>alert('亲爱的，您还没有告诉我你的名字哦？');history.back();</Script>"
response.end 
end if

if u_mail="" then
response.write "<Script language=JavaScript>alert('亲爱的，你还没有告诉我你的邮箱呢？');history.back();</Script>"
response.end 
end if

if us_url<>"" and instr(us_url,".")<=0 then
response.write "<Script language=JavaScript>alert('亲爱的，网站地址错误，可以为空，正确格式如：www.08296.com');history.back();</Script>"
response.end 
end if

if instr(u_mail,"@")<=0 or instr(u_mail,".")<=0 then
response.write "<Script language=JavaScript>alert('亲爱的，邮箱填写有错误，正确格式如：me@isea.so');history.back();</Script>"
response.end 
end if

if u_content="" then
response.write "<Script language=JavaScript>alert('亲爱的，你还没有告诉我你要说的话呢？');history.back();</Script>"
response.end 
end if

if instr(u_content,"http://")>0 or instr(u_mail,"www")>0 then
response.write "<Script language=JavaScript>alert('您的信息已触发反垃圾系统，请检查修正后重新提交！');history.back();</Script>"
response.end 
end if

function HasChinese(str)
HasChinese = false
dim ia
for ia=1 to Len(str)
if Asc(Mid(str,ia,1)) < 0 then
HasChinese = true
exit for
end if
next
end function

jc=HasChinese(u_content)
if jc = false then
response.write "<Script language=JavaScript>alert('亲爱的，您提交的信息已被反垃圾系统拦截，请修正后重新提交？');history.back();</Script>"
response.end 
end if

if huifu=1 then
huifutz=1
else
huifutz=0
end if

userips = Request.ServerVariables("HTTP_X_FORWARDED_FOR") 
If userips = "" Then 
userips = Request.ServerVariables("REMOTE_ADDR") 
end if

IPArray=Split(userips,".",-1,1)
For ii=0 To 3
	tIpi = tIpi +IPArray(ii)*256^(3-ii)
Next
IP=tIpi

if us_url ="" then
u_url=""
elseif instr(us_url,"http://")>0 then
u_url=us_url
else
u_url=trim("http://"&us_url)
end if

if jizhu=1 then
Response.Cookies("u_name")=""&u_name&""
Response.Cookies("u_mail")=""&u_mail&""
Response.Cookies("u_url")=""&u_url&""
Response.Cookies("u_name").Expires=DateAdd("m",3,now())
Response.Cookies("u_mail").Expires=DateAdd("m",3,now())
Response.Cookies("u_url").Expires=DateAdd("m",3,now())
else
Response.Cookies("u_name")=""
Response.Cookies("u_mail")=""
Response.Cookies("u_url")=""
end if
%>

<% 
set rs=server.createobject("adodb.recordset")
sql="select lysh,plsh,pltz,lytz,fjryx,fjrmc,z_title,hxdz,faname,fapass,smtpname,z_jsmail from Web_Advanced_Settings"
rs.open(sql),conn,1,1
lysh=rs("lysh") '留言审核开关
plsh=rs("plsh") '评论审核开关
pltz=rs("pltz") '评论开关
lytz=rs("lytz") '留言开关
fjryx=rs("fjryx") '发件人邮箱
fjrmc=rs("fjrmc") '发件人名称
z_title=rs("z_title") '邮件标题
hxdz=rs("hxdz") '指定回信地址
faname=rs("faname") '发送服务器登录名称
fapass=rs("fapass") '发送服务器登录密码
smtpname=rs("smtpname") 'smtp服务器名称
z_jsmail=rs("z_jsmail") '接收通知的邮箱
rs.close
set rs=nothing
%>

<%
set rs=server.createobject("adodb.recordset")
sql="select u_mail,u_touxiang from web_Article_comment where u_mail like '"&u_mail&"'"
rs.open(sql),conn,1,1
If rs.bof And rs.eof Then
Public Function BornVerifyCode() Randomize '设置随机因子
BornVerifyCode=Mid((Rnd * 100), 1, 2)
End Function
code=replace(BornVerifyCode,".", "")
else
code=rs("u_touxiang")
end if
rs.close
set rs=nothing
%>

<%
set rs=server.createobject("adodb.recordset")
sql="select * from web_shuoshuo_comment"
rs.open sql,conn,1,3
rs.addnew
rs("su_sid")=""&post_id&""
rs("su_name")=""&u_name&""
rs("su_mail")=""&u_mail&""
rs("su_url")=""&u_url&""
rs("su_touxiang")=""&code&""
rs("su_content")=""&u_content&""
rs("su_huifutz")=""&huifutz&""
if plsh=1 then
rs("su_view")=0
else
rs("su_view")=1
end if

rs("su_time")=now()
rs("su_ip")=""&IP&""
rs.update
rs.close
set rs=nothing
%>

<% if pltz=1  then%>

<% 
set rs=server.createobject("adodb.recordset")
sql="select s_id,s_content from web_shuoshuo where s_id="&post_id&""
rs.open(sql),conn,1,1
w_id=rs("s_id")
w1_title=rs("s_content")
w_title=RemoveHTML(""&w1_title&"",10)
rs.close
set rs=nothing
%>

<% 
set rs=server.createobject("adodb.recordset")
sql="select web_url,web_name,web_author from Web_Setting"
rs.open(sql),conn,1,1
web_url=rs("web_url")
web_name=rs("web_name")
web_author=rs("web_author")
rs.close
set rs=nothing
%>


<%
''=========利用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=""&fjryx&""
'发件人名称
jmail.fromname=""&fjrmc&""
'收件人邮箱,姓名  
jmail.AddRecipient t1,t2
'邮件的紧急程度，1最快，5最慢
jmail.Priority=2
'发送邮件标题
jmail.subject=""&z_title&"说说评论"
'指定别的回信地址   
JMail.ReplyTo=""&hxdz&""

JMail.HTMLBody = "<html><head><meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312""></head><body>"&t3&"</body></html>"

jmail.mailserverusername=""&faname&""       '邮件发送服务器登录名称
jmail.mailserverpassword=""&fapass&""       '邮件发送服务器登录密码
sendok=jmail.send(""&smtpname&"")         'smtp服务器名称

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

jmail.Close
set jmail=nothing
End Function

if u_mail<>"" then
m_mail="<p style='background-color: #f2f2f2;border-radius:6px;border: 1px solid #DDD;padding: 10px 5px;margin: 15px 0;'>邮箱："&u_mail&"</p>"
end if

if u_url<>"" then
m_url="<p style='background-color: #f2f2f2;border-radius:6px;border: 1px solid #DDD;padding: 10px 5px;margin: 15px 0;'>网站："&u_url&"</p>"
end if
''=========利用Jmail在线发送邮件函数 end=============

''调用上面定义的函数发送邮件的方法
''邮件里面的内容
response.write sendjmail(""&z_jsmail&"",""&fjrmc&"","<div style='background-color:#fff; border:1px solid #135685; color:#111; border-radius:8px; font-size:13px; width:100%; margin:0 auto; margin-top:10px; font-family:微软雅黑, Arial; margin-left: 1px;'><div style='background:#135685; width:100%; height:60px; color:white; border-radius:6px 6px 0 0; '><span style='height:60px; line-height:60px; margin-left:30px; font-size:20px;'><a style='text-decoration:none; color:#00bbff;font-weight:600;'  href='"&web_url&"'  target='_blank'>"&web_name&"</a> 上有了新的说说评论：</span></div><div style='width:90%; margin:0 auto'><p>亲爱的 [ <a style='text-decoration:none; color:#0473b2'>"&web_author&"</a> ] ：您好!</p><p>[ <a style='text-decoration:none; color:#0473b2'>"&u_name&"</a> ] 在[ <a style='text-decoration:none; color:#0473b2'  href='"&web_url&"' target='_blank'>"&web_name&"</a> ] 上对说说《 <a style='text-decoration:none; color:#0473b2' href='"&web_url&"/shuos/?"&w_id&".html'  target='_blank'> "&w_title&" </a> 》发表了评论:</p><p style='background-color: #f2f2f2;border-radius:6px;border: 1px solid #DDD;padding: 10px 5px;margin: 15px 0;'>"&u_content&"</p>"&m_mail&""&m_url&"<p>您可以点击  <a style='text-decoration:none; color:#0473b2'  href='"&web_url&"/shuos/?"&w_id&".html#Comment' target='_blank'>查看完整內容</a>；</p><p style='color:#0473b2;'><b>温馨提示</b>：本邮件由系统自动发出，请勿直接回复！ </p></div></div>")
%>

<% end if %>

<%
if plsh=1 then
Response.Write("<SCRIPT language=JavaScript>alert('恭喜，评论已成功发表，待管理员审核通过后显示!');this.location.href='"&request.ServerVariables("HTTP_REFERER")&"';</SCRIPT>")
elseif plsh<>1 then
Response.Write("<SCRIPT language=JavaScript>alert('恭喜，评论已成功发表!');this.location.href='"&request.ServerVariables("HTTP_REFERER")&"';</SCRIPT>")
end if
%>
<!-- #include file="../inc/close.asp" -->