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

📄 yd_guestbook_rea.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  异度空间技术部
'------------------------------------------------------------------------
Dim Thid
Response.Buffer=True
Dvbbs.Stats="回复留言"
Dvbbs.Nav()
Dvbbs.Head_var 0,0,""&guestbook_setting(0)&"","YD_guestbook_index.asp"
call GuestState()
select case request("action")
	case "SaveNew"
		call SaveNew()
	case else
		call main()
end select

Dvbbs.ActiveOnline
Dvbbs.footer()

sub main()
dim Thid,sql,rs
Thid=request("Thid")
if not isnumeric(Thid) then
	Response.Redirect "YD_guestbook_Save.asp?action=information&sid=2&act=<li>错误的参数,请指定正确的主题回复。&Flag=2"
end if

sql="select Thid from YD_Guest_Theme where Thid="&Thid&""
Set Rs=guestbook_conn.execute(sql)
if Rs.eof and Rs.bof then
	Rs.close
	Set Rs=nothing
	Response.Redirect "YD_guestbook_Save.asp?action=information&sid=2&act=<li>没有找到您要回复的主题。&Flag=2"
end if
Rs.close
Set Rs=nothing

sql="select padlock from YD_Guest_topic where id="&Thid&""
Set Rs=guestbook_conn.execute(sql)
if rs(0)=1 then
	Rs.close
	Set Rs=nothing
	Response.Redirect "YD_guestbook_Save.asp?action=information&sid=2&act=<li>错误该留言已被锁定不能回复。&Flag=2"
end if
Rs.close
Set Rs=nothing
%> 

<table class=tableborder1 cellspacing=1 cellpadding=3 align=center border=0 > 
  <tr> 
    <th align="center" colspan="3" height="25"><b>回复留言对话</b></th> 
  </tr> 
  <form method=post action="?action=SaveNew&Thid=<%=Thid%>"> 
    <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%><%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)%><%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 valign=top class=tablebody1 colspan="2"><B>&nbsp;验证码:</B>
      <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 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> 
</table> 
<%
End sub

Sub SaveNew()
Dim Thid,zhuti,mincheng,Oicq,E_mail,neirong,xingqingtu,face
Dim rootid,Sip,MyWeb,infoname,title,isSend,vcode
Thid=request("Thid")
if Thid = "" and not isnumeric(Thid) then
	errmess="<li>参数有错"
	call endinfo(2)
	exit sub
end if
sql="select SaveTheme from YD_Guest_topic where id="&Thid&""
Set Rs=guestbook_conn.execute(sql)
zhuti=rs(0)
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"))
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 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_Theme(Thid,Content,AnswerName,AnswerEmail,AnswerColor,AnswerOicq,AnswerExpress,AnswerFace,AnswerIp,SaveTime,AnswerWeb) values ('"&Thid&"','"&neirong&"','"&mincheng&"','"&E_mail&"','"&request.Form("color")&"','"&Oicq&"','"&xingqingtu&"','"&face&"','"&Sip&"',"&G_NowString&",'"&MyWeb&"')")
guestbook_conn.execute("update YD_Guest_topic set AnswerNumber=AnswerNumber+1,SaveTime="&G_NowString&",LastName='"&mincheng&"',LastCon='"&left(neirong,12)&"...' where id="&Thid)
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
	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 + -