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

📄 yd_guestbook_theme.asp

📁 是个不错的留言版
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="YD_guestbook_CONN.asp"-->
<!--#include file="YD_guestbook_Const.asp"-->
<script language="JavaScript1.2">
<!--
function confirm_delete(){
	if (confirm("您确定要删除吗?")){
		return true;
	}
	return false;
}
//-->
</script>

<%
'------------------------------------------------------------------------
'By 玄天尊, 更新于2005-05-19 晚.
'和论坛结合的留言本,分会员与游客两种模式
'可定义是否使用验证码,防止恶意留言
'ACCESS与MSSQL通用版本
'www.YdSpace.org And www.YdSpace.net  异度空间技术部
'------------------------------------------------------------------------
Dim Thid,SaveTheme
Dim bgcolor,abgcolor,star
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()
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 * 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 SaveTheme from [YD_Guest_topic] where id="&ThId&""
Set Rs=guestbook_conn.execute(sql)
SaveTheme=rs("SaveTheme")
Rs.close
Set Rs=Nothing

Sql="select Content,AnswerName,AnswerEmail,AnswerExpress,AnswerFace,SaveTime,AnswerOicq,AnswerWeb,AnswerIp,id,AnswerColor,Isuser from [YD_Guest_Theme] where Thid="&Thid&" order by -id desc"
%>
<table class=tableborder1 cellspacing=1 cellpadding=3 align=center border=0>
<a href="YD_guestbook_Ann.asp"><img src="YD_plus/guest/1.gif" alt="写一个新留言" border=0></a>&nbsp;
<a href="YD_guestbook_Rea.asp?ThId=<%=ThId%>"><img src="YD_plus/guest/2.gif" alt=回复留言 border=0></a>
  <tr>
    <th height=25 colSpan=2 align=left>&nbsp;*&nbsp;留言主题:<%=htmlencode(SaveTheme)%></th>
  </tr>
<%
currentPage=request("page")
If currentpage="" or not isnumeric(currentpage) then
	currentpage=1
End if

Set Rs= Server.CreateObject("ADODB.Recordset")
Rs.open SQL,guestbook_conn,1,1
If not Rs.eof and not Rs.bof then
	Rs.PageSize=10
	Rs.AbsolutePage=currentpage
	page_count=0
	totalrec=Rs.recordcount
	do while (not Rs.eof) and (not page_count = Rs.PageSize)
		If bgcolor="tablebody1" then
			abgcolor="tablebody1"
			bgcolor="tablebody2"
		Else
			abgcolor="tablebody2"
			bgcolor="tablebody1"
		End if
%>
  <tr>
    <td width=18% class=<%=bgcolor%> valign=top align=left>
	<BR>&nbsp;&nbsp;<img src="<%=rs(4)%>">
	<BR>&nbsp;&nbsp;<%if rs(11)=0 then%>游客<%else%>会员<%end if%>:<b><%=rs(1)%></b>
	<BR>&nbsp;&nbsp;发表于:<%=FormatDateTime(rs(5),2)%>
    </td>
    <td width=82% class=<%=bgcolor%> valign=top align=left>
	&nbsp;<a title="给[<%=htmlencode(rs(1))%>]发电子邮件" href="mailto:<%=htmlencode(rs(2))%>?subject=你好"><img border="0" src="Skins/Default/email.gif"></a>
	&nbsp;<a title="访问作者:“<%=htmlencode(rs(1))%>”的[<%=htmlencode(rs(7))%>]站点" target="_blank" href="<%=htmlencode(rs(7))%>"><img border="0" src="Skins/Default/homepage.gif"></a>
	&nbsp;<a title="[<%=htmlencode(rs(1))%>]的<%=htmlencode(rs(6))%>QQ情况" href="http://search.tencent.com/cgi-bin/friend/user_show_info?ln=<%=htmlencode(rs(6))%>"><img border="0" src="YD_plus/guest/oicq.gif"></a>
	&nbsp;<a title="回复留言" href="YD_guestbook_Rea.asp?ThId=<%=Thid%>"><img border="0" src="Skins/Default/reply_a.gif"></a>
	<hr color="#6699FF" size="1" width="97%" align="center"><blockquote><img src="Skins/Default/topicface/<%=rs(3)%>" title="留言时心情">&nbsp;<font color=<%=rs(10)%>><%=htmlencode(rs(0))%></font></blockquote>
    </td>
  </tr>
  <tr>
    <td class=<%=bgcolor%> align=left>&nbsp;&nbsp;<img title="<%If dvbbs.master then%>留言时用户的&nbsp;IP:<%=rs(8)%><%else%>留言用户的IP已设置保密<%end if%>" border="0" src="Skins/Default/ip.gif"><%If dvbbs.master then%>&nbsp;<%=rs(8)%><%else%>&nbsp;IP已设置保密<%end if%></td>
    <td class=<%=bgcolor%> align=right>
<%
if dvbbs.master then
	response.write "<a title=""编辑这个留言"" href=""YD_guestbook_admin_Edit.asp?Tid="&rs(9)&"""><img border=""0"" src=""Skins/Default/edit.gif""></a>&nbsp;<a onClick=""return confirm_delete()"" title=""删除这个留言!"" href=""YD_guestbook_admin_del.asp?action=DelTh&Tid="&rs(9)&"""><img border=""0"" src=""YD_plus/guest/delete.gif""></a>&nbsp;"
end if
%>
    </td>
  </tr>
<%
		page_count = page_count + 1
		Rs.movenext
	loop
	Pcount=Rs.PageCount
%>
  <tr>
    <td Class=tablebody1 colspan=1 Align=Left>&nbsp;本主题 <Font Color=blue><%=totalrec%></Font> 条
    <td Class=tablebody1 colspan=1 Align=Right>分页:<%call disppagenum(currentpage,Pcount,"""?ThId="&ThId&"&page=","""")%></td>
  </tr>
</table><br>
<%
End if
Rs.close
Set Rs=nothing
%>
<!--快速回复部分开始-->
<table class=tableborder1 cellspacing=1 cellpadding=3 align=center>
  <tr>
    <th height="25" colSpan="2" align="left">&nbsp;*&nbsp;快速回复主题:<%=htmlencode(SaveTheme)%></th>
  </tr>
  <form method=post action="?action=SaveNew&Thid=<%=Thid%>">
  <tr>
    <TD width=18% class=tablebody2 align=center>留言模式:<%if Guestbook_User=1 then%>会员模式<%else%>游客模式<%end if%></TD>
    <TD width=82% class=tablebody2>
	&nbsp;昵称:<input name=mincheng size=23 <%if Guestbook_User=1 then%>value=<%=Dvbbs.Membername%><%end if%>>&nbsp;
	&nbsp;信箱:<input name=E_mail size=23 <%if Guestbook_User=1 then%>value=<%=Dvbbs.MyUserInfo(7)%><%end if%>>&nbsp;
	&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%>
    </td>
  </tr>
  <tr>
    <TD class=tablebody2 align="center"><img id=face src=Images/userface/Image1.gif></TD>
    <TD class=tablebody2>&nbsp;<textarea name="neirong" cols="99" rows="8"></textarea></td>
  </tr>
  <tr>
    <TD class=tablebody2 align="center">&nbsp;</TD>
    <td align="left" class=tablebody2>&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%>&nbsp;&nbsp;<% if guestbook_setting(2)=1 then %>验证码:<input name="vcode" type="text" id="vcode" size="4" maxlength="4"> 
      &nbsp; <img src="Dv_getcode.asp" border="0"><%end if%><input type=submit name="submit" value="提 交">&nbsp;&nbsp;<input type="reset" name="submit" value="重 填"></td>
  </tr>
  </form>
</table>
<!--快速回复部分结束-->
<%
End sub

Sub SaveNew()
Dim Thid,mincheng,E_mail,neirong,huibiao,face,Sip,huifucishu
Dim infoname,title,isSend,zhuti,padlock,vcode
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 SaveTheme,Padlock from YD_Guest_topic where id="&Thid&""
Set Rs=guestbook_conn.execute(sql)
zhuti=rs(0)
padlock=rs(1)
mincheng=trim(replace(Request.form("mincheng"),"'",""))
neirong=trim(replace(Request.form("neirong"),"'",""))
Sip=request.ServerVariables("REMOTE_ADDR")
face=trim(Request.Form("face")&"")
infoname=trim(replace(Request.form("infoname"),"'",""))
e_mail = trim(replace(request.form("e_mail"),"'",""))

'如果需要验证码
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 rs(1)=1 then
	errmess="<li>错误该留言已被锁定不能回复。"
	call endinfo(1)
	exit sub
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 request("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 neirong="" then
	errmess="<li>错误请输入内容。"
	call endinfo(2)
	exit sub
End if

huibiao="face1.gif"
guestbook_conn.execute("insert into YD_Guest_Theme(Thid,Content,AnswerName,AnswerEmail,AnswerExpress,AnswerFace,AnswerIp,SaveTime,Isuser) values ('"&Thid&"','"&neirong&"','"&mincheng&"','"&e_mail&"','"&huibiao&"','"&face&"','"&Sip&"',"&G_NowString&",'"&Guestbook_User&"')")
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="&ThId&">留言板</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 + -