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

📄 yd_guestbook_ann.asp

📁 是个不错的留言版
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="YD_guestbook_CONN.asp" -->
<!--#include file="YD_guestbook_Const.asp" -->
<%
'------------------------------------------------------------------------
'By 玄天尊, 更新于2005-05-19 晚.
'和论坛结合的留言本,分会员与游客两种模式
'可定义是否使用验证码,防止恶意留言
'ACCESS与MSSQL通用版本
'www.YdSpace.org And www.YdSpace.net  异度空间技术部
'------------------------------------------------------------------------
Response.Buffer=True
Dvbbs.Stats="写留言"
Dvbbs.Nav()
Dvbbs.Head_var 0,0,""&guestbook_setting(0)&"","YD_guestbook_index.asp"
call GuestState()
call main()
Dvbbs.ActiveOnline
Dvbbs.footer()

sub main()
%>
<table class=tableborder1 cellspacing=1 cellpadding=3 align=center>
<%
select case request("action")
case "SaveNew"
	call SaveNew()
case else
	call write()
end select
%>
</table>
<%
end sub

sub write()
%>
  <tr>
    <th align="center" colspan="3" height="25"><a name=top></a><b>发表新留言</b></th>
  </tr>
  <form method=post action="?action=SaveNew">
  <tr>
    <TD width=25% class=tablebody1 colspan="2"><B>昵 称:</B><li>填写您的称呼。</TD>
    <TD width=75% class=tablebody1>&nbsp;<input name=mincheng size=30 <%if Guestbook_User=1 then%>value=<%=Dvbbs.Membername%> readonly="true"<%end if%>>&nbsp;&nbsp;<font color=red>*</font>不得超过12个英文字符</td>
  </tr>
  <tr>
    <TD class=tablebody1 colspan="2"><B>信 箱:</B><li>填写您的Email地址。</TD>
    <TD class=tablebody1>&nbsp;<input name=E_mail size=30 <%if Guestbook_User=1 then%>value=<%=Dvbbs.MyUserInfo(7)%> readonly="true"<%end if%>>&nbsp;&nbsp;<font color=red>*</font></td>
  </tr>
  <tr>
    <TD class=tablebody1 colspan="2"><B>网 址:</B><li>填写您的Web地址。</TD>
    <TD class=tablebody1>&nbsp;<input name=MyWeb size=30 value=http://></td>
  </tr>
  <tr>
    <TD class=tablebody1 colspan="2">&nbsp;<B>OICQ:</B><li>填写您的Oicq号码。</TD>
    <TD class=tablebody1>&nbsp;<input name=Oicq size=30></td>
  </tr>
  <% if guestbook_setting(2)=1 then%>
  <tr><td class="tablebody1" colspan="2">&nbsp;<b>验证码:</b><li>请填写右边的验证码。</li></td>
  <td class="tablebody1">&nbsp;<input name="vcode" type="text" id="vcode" size="4" maxlength="4"> 
      &nbsp; <img src="Dv_getcode.asp" border="0"></td></tr>
  <% end if %>
  <tr>
    <td class=tablebody1 colspan="2"><b>主题标题:</b><li>内容的标题,必须填写。</td>
    <td class=tablebody1>&nbsp;<input name=zhuti size=62 maxlength=80>&nbsp;&nbsp;<font color=red>*</font>不得超过50个英文字符</td>
  </tr>
  <tr>
    <td width=25% valign=top class=tablebody1 colspan="2"><b>当前心情:</b><li>将放在留言的前面</td>
    <td width=75% class=tablebody1>
	<%for i=1 to 9%>
	<input type="radio" value="face<%=i%>" name="xingqingtu" <%if i=1 then response.write "checked"%>><img src="Skins/Default/topicface/face<%=i%>.gif">&nbsp;&nbsp;<%next%>
	<br>
	<%for i=10 to 18%>
	<input type="radio" value="face<%=i%>" name="xingqingtu"><img src="Skins/Default/topicface/face<%=i%>.gif">&nbsp;&nbsp;
	<%next%>
    </td>
  </tr>
  <tr>
    <td class=tablebody1 width="25%" valign="top" align="left" colspan="2"><B>请选择头像:</B><li>头像将出现在您的留言中</td>
    <td class=tablebody1 width="75%" valign="top" align="left" rowspan="2">&nbsp;选择头像:&nbsp;<select name=face size=1 onChange="document.images['face'].src=options[selectedIndex].value;">
	<%for i=1 to 60%>
	<option value='Images/userface/Image<%=i%>.gif'>Image<%=i%></option>
	<%next%>
	</select>&nbsp;&nbsp;颜色:&nbsp;<SELECT name=color>
			<option style="background-color:black;color: black" value="black">黑色 </option>
			<option style="background-color:blue;color: blue" value="blue">蓝色 </option>
			<option style="background-color:red;color: red" value="red">红色 </option>
			<option style="background-color:olive;color: olive" value="olive">橄榄色 </option>
			<option style="background-color:teal;color: teal" value="teal" selected>青色 </option>
			<option style="background-color:maroon;color: maroon" value="maroon">栗色 </option>
			<option style="background-color:navy;color: navy" value="navy">海蓝色 </option>
			<option style="background-color:gray;color: gray" value="gray">灰色 </option>
			<option style="background-color:lime;color: lime" value="lime">绿色 </option>
			<option style="background-color:Fuchsia;color: Fuchsia" value="Fuchsia">紫色 </option>
			<option style="background-color:yellow;color: yellow" value="yellow">黄色 </option>
			<option style="background-color:green;color: green" value="green">深绿色 </option>
			<option style="background-color:Purple;color: Purple" value="Purple">深紫色 </option>
			</SELECT>&nbsp;&nbsp;站内短信通知:&nbsp;<input <%If User_Setting(0)=0 then%>readonly<%End if%> name=infoname size=15 value="<%=htmlencode(guestbook_setting(1))%>">&nbsp;<%If User_Setting(0)=0 then%><font color="red">禁用</font><%Else%>启用<%End if%><BR>&nbsp;<textarea name="neirong" cols="95" rows="12"></textarea>
    </td>
  </tr>
  <tr>
    <td class=tablebody1 width="13%" valign="middle"><B>内容:</B><li>不支持html语法<li>UBB标签不支持</td>
    <td class=tablebody1 width="12%" align="center"><img id=face src=Images/userface/Image1.gif></td>
  </tr>
  <tr>
    <td align="center" colspan="3" class=tablebody1><input type=submit name="submit" value="提 交">&nbsp;&nbsp;<input type="reset" name="submit" value="重 填"></td>
  </tr>
  </form>
<%
End sub

Sub SaveNew()
Dim mincheng,Oicq,E_mail,zhuti,neirong,xingqingtu,face,vcode
Dim rootid,Sip,MyWeb,infoname,title,isSend
mincheng=trim(replace(Request.form("mincheng"),"'",""))
E_mail=trim(replace(Request.form("E_mail"),"'",""))
MyWeb=trim(replace(Request.form("MyWeb"),"'",""))
Oicq=trim(Request.form("Oicq"))
zhuti=trim(replace(Request.form("zhuti"),"'",""))
infoname=trim(Request.form("infoname"))
neirong=Request.form("neirong")
Sip=request.ServerVariables("REMOTE_ADDR")
xingqingtu=trim(Request.Form("xingqingtu")&".gif")
face=trim(Request.Form("face")&"")

'如果需要验证码
if guestbook_setting(2) = 1 then
vcode = trim(replace(request.Form("vcode"),"'",""))
	if vcode = "" then
		errmess = "<li>错误请输入验证码"
		call endinfo(2)
	exit sub
	end if 
	 
	if vcode <> Session("GetCode") then
		errmess = "<li>验证码不正确"
		call endinfo(2)
		exit sub
	end if 
	
end if 
If mincheng="" then
	errmess="<li>错误请输入您的姓名。"
	call endinfo(2)
	exit sub
End if

If len(mincheng)>12 then
	errmess="<li>错误姓名长度不能超过12个英文字符"
	call endinfo(2)
	exit sub
End if

If E_mail=""  then
	errmess="<li>错误E_mail地址必须输入。"
	call endinfo(2)
	exit sub
End if

If len(E_mail) <> 0 and InStr(2,E_mail,"@")=0 then
	errmess="<li>错误E_mail地址错误。"
	call endinfo(2)
	exit sub
End if

If len(E_mail)>25 then
	errmess="<li>错误E_mail长度不能超过25个英文字符"
	call endinfo(2)
	exit sub
End if

If len(MyWeb)>60 then
	errmess="<li>错误网址长度不能超过60个英文字符"
	call endinfo(2)
	exit sub
End if

If Oicq<>"" then
	If not isnumeric(Oicq) or len(Oicq)>18 then
		errmess="<li>错误Oicq号码必须输入数字。"
		call endinfo(2)
		exit sub
	End if
End if

If zhuti="" then
	errmess="<li>错误请输入主题。"
	call endinfo(2)
	exit sub
End if

If len(zhuti)>50 then
	errmess="<li>主题长度不能超过50个英文字符"
	call endinfo(2)
	exit sub
End if

If neirong="" then
	errmess="<li>错误请输入内容。"
	call endinfo(2)
	exit sub
End if

If len(neirong)>1000 then
	errmess="<li>内容长度不能超过1000个英文字符"
	call endinfo(2)
	exit sub
End if

neirong=Replace(neirong,"'","''")
guestbook_conn.execute("insert into YD_Guest_topic(UserName,Express,SaveTheme,ThemeEmail,ThemeFace,ThemeOicq,SaveTime,LastName,ThemeIp,ThemeWeb,LastCon) values ('"&mincheng&"','"&xingqingtu&"','"&zhuti&"','"&E_mail&"','"&face&"','"&Oicq&"',"&G_NowString&",'"&mincheng&"','"&Sip&"','"&MyWeb&"','"&left(neirong,12)&"...')")
set rs=guestbook_conn.execute("select top 1 id from [YD_Guest_topic] order by id desc")
rootid=rs(0)
rs.close
set rs=nothing
guestbook_conn.execute("insert into YD_Guest_Theme(Content,Thid,SaveTime,AnswerExpress,AnswerFace,AnswerName,AnswerEmail,AnswerColor,AnswerOicq,AnswerIp,AnswerWeb,Distinguish,Isuser) values ('"&neirong&"','"&rootid&"',"&G_NowString&",'"&xingqingtu&"','"&face&"','"&request.Form("mincheng")&"','"&E_mail&"','"&request.Form("color")&"','"&Oicq&"','"&Sip&"','"&MyWeb&"','1','"&Guestbook_User&"')")
title="“"&mincheng&"”在留言板给您留言了"
neirong="作者:"&mincheng&"<BR>主题是:"&zhuti&"<BR>内容:"&left(neirong,150)&"...<BR><BR>转到:<a title=转到留言页面 target=_blank href=YD_guestbook_Theme.asp?ThId="&rootid&">留言板</a>"
If infoname>"" then
	Sql="select * from Dv_User where UserName='"&infoname&"'"
	Set rs=conn.execute(sql)
	If Rs.eof then
		Response.Redirect "YD_guestbook_Save.asp?action=information&sid=2&act=<li>恭喜,您的留言成功!由于论坛里未找到收信人,短信发送失败。&Flag=2"
		Exit sub
	End if
	rs.close
	set rs=nothing
	Conn.execute("insert into Dv_Message(sender,incept,title,content,sendtime,isSend) values('留言板','"&infoname&"','"&title&"','"&neirong&"',"&SqlNowString&",1)")	
End if
Response.Redirect "YD_guestbook_Save.asp?action=information&sid=1&act=<li>恭喜,您的留言成功!请返回。&Flag=2"
End sub
%>

⌨️ 快捷键说明

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