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

📄 gustbook.asp

📁 1、界面采用欧试风格,设计唯美.   2、可调用留言,能做为评论模块用于其他系统的开发.   3、代码简洁,功能实用.
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="gustbook_Conn.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Qs521留言本 www.Qs521.com</title>
<style type="text/css">
<!--
body,td,th {
	font-family: 宋体;
	font-size: 9pt;
	color: #666666;
}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #FFFFFF;
}
a:link {
	color: #333333;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #666666;
}
a:hover {
	text-decoration: underline;
	color: #FFFFFF;
}
a:active {
	text-decoration: none;
	color: #999999;
}
.STYLE1 {
	color: #FFFFFF;
	font-weight: bold;
}
.shixian1 {
	border: 1px solid #787878;
}
.xixian {
	border: 1px solid #F3F3F3;
}
-->
</style>
</head>

<body>
<% 

'过滤代码
Function htmlencode(fString)
If not isnull(fString) then
    fString = replace(fString, ">", "&gt;")
    fString = replace(fString, "<", "&lt;")
    fString = Replace(fString, CHR(32), "&nbsp;")
    fString = Replace(fString, CHR(9), "&nbsp;")
    fString = Replace(fString, CHR(34), "&quot;")
    fString = Replace(fString, CHR(39), "&#39;")
    fString = Replace(fString, CHR(13), "")
    fString = Replace(fString, CHR(10) & CHR(10), "</p><p> ")
    fString = Replace(fString, CHR(10), "<br> ")
	htmlencode = fString
End If
End Function

Function uhtmlencode(fString)
If not isnull(fString) then
	fString = Replace(fString, "&nbsp;", CHR(32))
	fString = Replace(fString, "&nbsp;", CHR(9))
	fString = Replace(fString, "&quot;", CHR(34))
	fString = Replace(fString, "&#39;", CHR(39))
	fString = Replace(fString, "", CHR(13))
	fString = Replace(fString, "</p><p> ", CHR(10) & CHR(10))
	fString = Replace(fString, "<br> ", CHR(10))
	uhtmlencode = fString
End If
End Function


'获取浏览器action
action=Request.Querystring("action")

'获取浏览器lanmu
lanmu=Request.Querystring("lanmu")

'lanmu是否为空
If lanmu="" then lanmu=0 End If

xsming=Request.Querystring("xsming")

Url=Url&"?lanmu="&lanmu
if xsming<>""then Url=Url&"&xsming="&xsming end if
%>

<table width="1003" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="109" align="right" valign="top" background="images/bjl2.jpg"><img src="images/bj_l1.jpg" width="109" height="479" /></td>
    <td align="center" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="40"><table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="48" height="28" background="images/ttl1.jpg">&nbsp;</td>
            <td background="images/ttm.jpg"><span class="STYLE1">欢迎使用Qs521留言本。官网:<span class="STYLE1">www.Qs521.com</span>   
                <% If xsming<>"" Then %>【<%= xsming %>】<% End If %>
现共有<% Set mRs= Server.CreateObject("adodb.recordSet")
	mRs.open "Select * from dqe_gustbook where lanmu="&lanmu, conn, 1, 1 
	dim j
	j=0
	do while not mRs.eof
	j=j+1
	mRs.movenext
	loop
	mRs.Close
	%><%= j %>篇留言。 <% If Session("dqe_Admin")<>adminname Then %><a href="<%= Url %>&action=login"><span class="STYLE1">管理</span></a><% Else %><a href="<%= Url %>&action=logout"><span class="STYLE1">退出管理</span></a><% End If %>
</span></td>
            <td width="43" height="28" background="images/ttr1.jpg">&nbsp;</td>
          </tr>
          
        </table></td>
      </tr>
      <tr>
        <td height="350" align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="0">
			<% 
Select Case action

Case "add"
'判断是否外部提交
dim From_url,Serv_url
From_url = Cstr(Request.ServerVariables("HTTP_Referer"))
Serv_url = Cstr(Request.ServerVariables("Server_Name"))
If mid(From_url,8,len(Serv_url)) <> Serv_url Then
	Response.Write "<script>alert('警告!\n\你正在从外部提交数据!!\n\请立即终止!!');this.location.href='"&Url&"';</SCRIPT>"
	Response.End
End If
'提交数据
Books_mingzi=htmlencode(Request.form("mingzi"))
If Books_mingzi="" then Books_mingzi="匿名者" End If
Books_biaoti=htmlencode(Request.form("biaoti"))
Books_neirong=htmlencode(Request.form("neirong"))
If Books_biaoti="" or Books_neirong=""  then	
    Response.Write "<script>alert('标题和内容不能为空!');this.location.href='"&Url&"';</SCRIPT>"
ElseIf len(Books_mingzi)>14 then
	Response.Write "<script>alert('昵称能大于7个汉字!');this.location.href='"&Url&"';</SCRIPT>"
ElseIf len(Books_biaoti)>23 or len(Books_biaoti)<2 then
	Response.Write "<script>alert('标题内容不能小于2个汉字,大于23个汉字!');this.location.href='"&Url&"';</SCRIPT>"
ElseIf len(Books_neirong)>600 or len(Books_neirong)<5 then
	Response.Write "<script>alert('留言内容不能小于5个汉字,大于600个汉字!');this.location.href='"&Url&"';</SCRIPT>"
Else
	Set mRs= Server.CreateObject("adodb.recordSet")
	mRs.open "Select * from dqe_gustbook", conn, 1, 3
	mRs.addnew
		mRs("who") = Books_mingzi
		mRs("biaoti") = Books_biaoti
		mRs("neirong") = Books_neirong
		mRs("lanmu") = lanmu
		mRs("zhiding") = 0
		mRs("shijian") = now()
		UserIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR") 
		If UserIP = "" Then userip = Request.ServerVariables("REMOTE_ADDR")
		mRs("ip") = UserIP
	mRs.update
	mRs.close
	Set mRs = nothing
		Response.Write "<script>alert('留言添加成功\n\Qs521官网:http://www.Qs521.com');this.location.href='"&Url&"';</SCRIPT>"
		Response.End
End If 
Case "upd"
'提交修改数据
Id=Request.Querystring("Id")
Books_mingzi=htmlencode(Request.form("mingzi"))
If Books_mingzi="" then Books_mingzi="匿名者" End If
Books_biaoti=htmlencode(Request.form("biaoti"))
Books_neirong=htmlencode(Request.form("neirong"))
If Books_biaoti="" or Books_neirong=""  then	
    Response.Write "<script>alert('标题和内容不能为空!');this.location.href='"&Url&"';</SCRIPT>"
ElseIf len(Books_mingzi)>14 then
	Response.Write "<script>alert('昵称能大于7个汉字!');this.location.href='"&Url&"';</SCRIPT>"
ElseIf len(Books_biaoti)>23 or len(Books_biaoti)<2 then
	Response.Write "<script>alert('标题内容不能小于2个汉字,大于23个汉字!');this.location.href='"&Url&"';</SCRIPT>"
ElseIf len(Books_neirong)>600 or len(Books_neirong)<5 then
	Response.Write "<script>alert('留言内容不能小于5个汉字,大于600个汉字!');this.location.href='"&Url&"';</SCRIPT>"
Else
	Set mRs= Server.CreateObject("adodb.recordSet")
	mRs.open "Select * from dqe_gustbook where Id="&Id, conn, 1, 3
		mRs("who") = Books_mingzi
		mRs("biaoti") = Books_biaoti
		mRs("neirong") = Books_neirong
		mRs("shijian") = now()		
	mRs.update
	mRs.close
	Set mRs = nothing
		Response.Write "<script>alert('留言添加成功\n\Qs521官网:http://www.Qs521.com');this.location.href='"&Url&"';</SCRIPT>"
		Response.End
End If 
'删除留言调用
Case "del"
Id=Request.Querystring("Id")
	If Id="" then
		Response.Write "<script>alert('非法操作:删除留言的ID参数不能为空!');this.location.href='"&Url&"';</SCRIPT>"
	    Response.End
	End If
	
	conn.execute("delete from dqe_gustbook where Id="&Id)
	Response.Write "<script>alert('留言删除成功!');this.location.href='"&Url&"';</SCRIPT>"
	Response.End
'修改留言置顶调用
Case "gai"
Id=Request.Querystring("Id")
	If Id="" then
		Response.Write "<script>alert('非法操作:修改置顶留言的ID参数不能为空!');this.location.href='"&Url&"';</SCRIPT>"
	    Response.End
	End If
	Set mRs= Server.CreateObject("adodb.recordSet")
	mRs.open "Select * from dqe_gustbook where id="&Id, conn, 1, 3
	if mRs("zhiding")=0 then mRs("zhiding")=1 else mRs("zhiding")=0 end if
	mRs.update
	mRs.close
	Response.Write "<script>alert('修改留言置顶成功!');this.location.href='"&Url&"';</SCRIPT>"
	Response.End

'退出后台调用
Case "logout"
	Session.Contents.Remove("dqe_Admin")
	Response.Write "<script>alert('管理这么长时间了是该休息了(退出管理成功)');this.location.href='"&Url&"';</SCRIPT>"
	Response.End
'登陆后台调用
Case "logincheck"
	Admin_User=htmlencode(Request.form("Admin_User"))
	Admin_Pass=Request.form("Admin_Pass")
	If Admin_User=adminname and Admin_Pass=password then
		Session("dqe_Admin")=adminname
		Response.Write "<script>alert('又到管理留言的时间了(登录成功)!');this.location.href='"&Url&"';</SCRIPT>"
		Response.End
	Else
		Response.Write "<script>alert('不是本站站长请不要乱登陆。');this.location.href='"&Url&"&action=login';</SCRIPT>"
		Response.End
	End If

'登陆页面
Case "login"
%>
			<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td width="18" height="16" align="right" valign="bottom"><img src="images/1.jpg" width="18" height="16" /></td>
                <td height="12" background="images/1r.jpg">&nbsp;</td>
                <td width="17" height="16" align="left" valign="bottom"><img src="images/2.jpg" width="17" height="16" /></td>
              </tr>
              <tr>
                <td width="13" background="images/4s.jpg">&nbsp;</td>
                <td><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                      <td height="30" align="left" valign="middle"><table width="100%" height="20"  border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td background="images/002.jpg">   <img src="images/jt.jpg" width="13" height="13" /> <span class="STYLE1">管理员登陆 <img src="images/jt2.jpg" width="3" height="13" /></span></td>
                          </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td>
                        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td height="50" class="shixian1"><form name="form1" id="form1" method="post" action="<%=Url%>&action=logincheck">
                              <table width="50%"  border="0" align="center" cellpadding="0" cellspacing="0">
                                <tr>
                                  <td width="20%" height="60" class="xixian"><div align="center">帐号:</div></td>
                                  <td width="47%" height="60" class="xixian">
                                       <div align="center">
                                         <input name="Admin_User" type="text" class="xixian" id="mingzi2" size="20" />
                                       </div></td>
                                  <td width="33%" rowspan="2" class="xixian"><div align="center">
                                      <input name="Submit2" type="image" value="提交" src="images/an.jpg" align="middle" width="114" height="111">
                                  </div></td>
                                </tr>
                                <tr>
                                  <td height="60" class="xixian"><div align="center">密码:</div></td>
                                  <td height="60" class="xixian">
                                    <div align="center">
                                      <input name="Admin_Pass" type="password" class="xixian" id="mingzi22" size="20" />
                                    </div></td>
                                </tr>
                              </table>
                            </form></td>
                          </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td height="10">&nbsp;</td>
                    </tr>
                </table></td>
                <td background="images/2x.jpg">&nbsp;</td>
              </tr>
              <tr>
                <td width="18" height="15" align="right" valign="top"><img src="images/4.jpg" width="18" height="15" /></td>
                <td height="12" background="images/3z.jpg">&nbsp;</td>

⌨️ 快捷键说明

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