⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendadd.asp

📁 一个简单的留言板
💻 ASP
字号:

<% response.buffer=true%>
<!-- #include file="conn.asp" -->
<%
'取出留言簿设定
 set sd=server.createobject("adodb.recordset")
sql="select * from admin " 
sd.open sql,con,1,1
if sd.eof and sd.bof then
response.write("留言簿设定出错!")
response.end
	  else
	  '取出外观设定
' gg=trim(sd("gg")) '公告
 name=trim(sd("name")) '网站名称
' page=trim(sd("page")) '每页显示留言条数
' back=trim(sd("back")) '背景图片
' bk=trim(sd("bk")) '边框颜色
' bt1=trim(sd("bt1")) '标题颜色1
' bt2=trim(sd("bt2")) '标题颜色2
' bt3=trim(sd("bt3")) '标题颜色3
' dy1=trim(sd("dy1")) '单元格颜色1
' dy2=trim(sd("dy2")) '单元格颜色2
' dq=trim(sd("dq")) '表格对齐方式
ubb=trim(sd("ubb")) '是否支持ubb代码及表情符号
'tz=trim(sd("tz")) '是否允许邮件通知站长回复
fs=trim(sd("fs")) '是否允许将留言发送到站长信箱
jz=trim(sd("jz")) '是否禁止留言
wz=trim(sd("wz")) '取出留言簿网址
zydz=trim(sd("zydz")) '取出主页地址
zzemail=trim(sd("email")) '取出邮件地址
snew=trim(sd("snew")) '取出是否允许邮件通知站长有新留言
nobq=trim(sd("nobq")) '取出是否禁止表情选择
 end if
sd.close
set sd=nothing
'判断是否禁止留言
if jz=1 then
%>
<script language=javascript>
{
alert("对不起此留言簿站长已禁止留言功能!");
window.location="index.asp";
}
</script>
<%
response.end
end if%>
<!--#include file="articlechar.inc"-->
<%
user=trim(request.form("user"))
if user="" then
response.write("出错啦!非法请求!<a href=index.asp>返回</a>")
response.end
end if
email=trim(request.form("email"))
founderr=false
email=trim(request.form("email"))
if email<>"" then
if IsValidEmail(email)=false then
   founderr=true
end if
if founderr then
response.write("你所填的电子邮件地址有问题请后退重新输入!<a href='vbscript:history.back'><font color=red>后退>></font></a>")
response.end
end if
else
email="#"
end if
home=trim(request.form("home"))
if home="" then
home="#"
end if
icq=trim(request.form("icq"))
if icq="" then
icq="#"
end if
oicq=trim(request.form("oicq"))
if oicq="" then
oicq="#"
end if
sex=trim(request.form("sex"))
if sex="" then
response.write("出错啦!非法请求!<a href=index.asp>返回</a>")
response.end
end if
pic=trim(request.form("pic"))
if pic=""  then
if nobq=1 then 
pic="1.gif"
else
response.write("出错啦!非法请求!<a href=index.asp>返回</a>")
response.end
end if
end if
nl=trim(request.form("nl"))
if nl="" then
response.write("出错啦!非法请求!<a href=index.asp>返回</a>")
response.end
end if
post=trim(request.form("post"))
if post="" then
post=0
end if
emailsend=trim(request.form("emailsend"))
if emailsend="" then
emailsend=0
end if
dat=now()
if sex="k" then
pic="nogender.gif"
else
pic=sex&pic
end if
nl=htmlencode2(nl)
'判断是否支持ubb及表情符号
if ubb=1 then
nl=ChkString(nl)
nl=ReplaceUrls(nl)
nl=Smile(nl)
zznl=nl '留言内容
end if
'判断是否将留言发送到站长信箱
if fs=1 then
'将留言发送到站长信箱
if post=1 then
if email="#" then
mail=zzemail
else
mail=email
end if
dim  objCDOMail
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From =mail 
objCDOMail.To =zzemail   
objcdomail.MailFormat = cdoMailFormatMime
objcdoMail.BodyFormat = cdoBodyFormatHTML
objCDOMail.Subject =name&"留言簿:["&user&"] 给您的信件"  
objCDOMail.Body ="站长您好!<br><br>这是"&user&"在您的留言簿上给您的悄悄话。<br><br>内容:<br>"&nl&chr(13)&chr(10)&"<br><br><br><a href='"&wz&"'>去留言簿看一看!</a><br><a href='"&zydz&"'>"&name&"</a>欢迎您的到来!"&chr(13)&chr(10)&"<br>Email:<a href='mailto:"&zzemail&"'>"&zzemail&"</a><br>"&dat   
objCDOMail.Send
Set objCDOMail = Nothing
nl="此留言被发送到站长信箱中。"
end if
end if

ip=request.servervariables("remote_addr")
response.write("请耐心等候系统正在回应中...... ")
set cn=server.createobject("adodb.connection")
set rs=server.createobject("adodb.recordset")
sql="select * from lyb "  
rs.open sql,con,1,3
rs.addnew
rs("user")=user
rs("email")=email
rs("home")=home
rs("icq")=icq
rs("oicq")=oicq
rs("sex")=sex
rs("pic")=pic
rs("nl")=nl
rs("post")=post
rs("emailsend")=emailsend
rs("dat")=dat
rs("ip")=ip
rs("red")="#"
rs.Update
rs.close
set cn=nothing
set rs=nothing
'判断是否允许邮件通知站长有新留言
if snew=1 then
'dim  objCDOMail
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From =zzemail 
objCDOMail.To =zzemail   
objcdomail.MailFormat = cdoMailFormatMime
objcdoMail.BodyFormat = cdoBodyFormatHTML
objCDOMail.Subject =name&"留言簿:["&user&"] 给您的信件"  
objCDOMail.Body ="站长您好!<br><br>"&user&"在您的留言簿上发表了新留言。<br><br>内容:<br>"&zznl&chr(13)&chr(10)&"<br><br><br><a href='"&wz&"'>去留言簿看一看!</a><br><a href='"&zydz&"'>"&name&"</a>欢迎您的到来!"&chr(13)&chr(10)&"<br>Email:<a href='mailto:"&zzemail&"'>"&zzemail&"</a><br>"&dat   
objCDOMail.Send
Set objCDOMail = Nothing
end if
Response.Redirect "index.asp"
%> 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -