📄 gbook.asp
字号:
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
input {
font-size: 12px;
background:#efefef;
}
.box {
border: 1px solid #003366;
}
-->
</style></head>
<body>
<%
select case action
case "del"
checkadmin
if id="" then
response.write"<div align=center><br><br><br><br>非法操作:删除留言的ID参数不能为空!</div>"
response.write"<meta http-equiv='refresh' content='1;URL=gbook.asp'>"
response.end
end if
conn.execute("DELETE FROM [guestbook] WHERE id="&id)
response.write"<div align=center><br><br><br><br>该留言删除成功!</div>"
response.write"<meta http-equiv='refresh' content='1;URL=gbook.asp'>"
case "add"
username=htmlencode(request.form("username"))
useraddress=htmlencode(request.form("useraddress"))
usermail=htmlencode(request.form("usermail"))
usertel=htmlencode(request.form("usertel"))
userfax=htmlencode(request.form("userfax"))
userhome=htmlencode(request.form("userhome"))
sendinfo=htmlencode(request.form("sendinfo"))
realname=session("realname")
if username="" or useraddress="" or sendinfo="" then
response.write"<div align=center><br><br><br><br>姓名、地址、留言必须填写!</div>"
else
conn.execute("INSERT INTO [guestbook](username,useraddress,usermail,usertel,userfax,userhome,sendinfo) VALUES('"&username&"','"&useraddress&"','"&usermail&"','"&usertel&"','"&userfax&"','"&userhome&"','"&sendinfo&"')")
response.write"<div align=center><br><br><br><br>留言添加成功,多谢您的留言!</div>"
response.write"<meta http-equiv='refresh' content='2;URL=gbook.asp'>"
response.end
end if
case "replyed"
checkadmin
reply=trim(htmlencode(request.form("reply")))
if id="" then
response.write"<div align=center><br><br><br><br>非法操作:回复留言的ID参数不能为空!</div>"
response.write"<meta http-equiv='refresh' content='1;URL=gbook.asp'>"
response.end
end if
conn.execute("UPDATE [guestbook] SET reply='"&reply&"',realname='"&session("realname")&"',replytime='"&now()&"' WHERE id="&id)
response.write"<div align=center><br><br><br><br>回复成功!</div>"
response.write"<meta http-equiv='refresh' content='1;URL=gbook.asp'>"
%>
<%
case "reply"
checkadmin
if id="" then
response.write"<div align=center><br><br><br><br>非法操作:回复留言的ID参数不能为空!</div>"
response.write"<meta http-equiv='refresh' content='1;URL=gbook.asp'>"
response.end
end if
set rs=conn.execute("SELECT * FROM [guestbook] WHERE id="&id)
if rs.eof then
response.write"<div align=center><br><br><br><br>该留言不存在!</div>"
response.write"<meta http-equiv='refresh' content='1;URL=gbook.asp'>"
response.end
end if
reply=rs("reply")
reply=htmlencode2("reply")
%>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" class="box">
<tr bgcolor="#006699">
<td height="25" colspan="2" style="color:white"><strong> 回复留言:</strong></td>
</tr>
<form name="form1" method="post" action="<%=filename%>?action=replyed&id=<%=id%>">
<tr>
<td width="43" height="37" align="center">留言:</td>
<td style="LEFT: 0px; WIDTH: 500; WORD-WRAP: break-word;color:#003366"><%=rs("sendinfo")%>
<%
if rs("reply")<>"" then
response.write"<span style='color:red'><b>上次回复:</b>"&rs("replytime")&"</span>"
end if
%></td>
</tr>
<tr>
<td height="25" align="center">回复:</td>
<td height="100" rowspan="2"><textarea name="reply" style="width:500;height:80" title="如清空则为删除回复"><%=reply%></textarea>
*</td>
</tr>
<tr>
<td height="70" align="center"> </td>
</tr>
<tr>
<td height="39" colspan="2" align="center"><input name="reset" type="reset" id="reset4" value=" 重新输入 ">
<input name="Submit" type="submit" id="Submit" value=" 回复留言 "></td>
</tr>
</form>
</table>
<br>
<%
set rs=nothing
case else
%>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" class="box">
<tr bgcolor="#006699">
<td width="442" height="25" style="color:white"> <strong><%=guesttitle%></strong></td>
<td width="156" align="center"> </td>
</tr>
<%
count=3
sql="select * from [guestbook] order by id desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
rs.pagesize=count
rc=rs.recordcount
pgnm=rs.pagecount
page=request.QueryString("page")
if page<>"" then page=clng(page)
if page="" or page=0 then page=1
if page>pgnm then page=pgnm
if pgnm>1 then rs.absolutepage=page
do while not rs.eof and count>0
count=count-1
%>
<tr>
<td height="65" colspan="2"><table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="5%" height="25" align="center"><font color='#006699' face='wingdings'>2</font></td>
<td width="65%">来自<font color=green><%=rs("useraddress")%></font>的<font color=blue><%=rs("username")%></font>在<font color=red><%=rs("sendtime")%></font>的留言:
<%
if session("admin")<>"" then
response.write" <a href='"&filename&"?action=reply&id="&rs("id")&"' style='color:green'>回复</a>"
response.write" <a href='"&filename&"?action=del&id="&rs("id")&"' style='color:red'>删除</a>"
end if
%> </td>
<td width="30%">
<%
if rs("userhome")<>"" then
response.write"<a href='"&rs("userhome")&"'>主页</a>"
end if
if rs("usermail")<>"" then
response.write" <a href='mailto:"&rs("usermail")&"'>E-mail</a>"
end if
if rs("usertel")<>"" then
response.write" <span style='color:blue;cursor:hand;' title='"&rs("usertel")&"'>电话</span>"
end if
if rs("userfax")<>"" then
response.write" <span style='color:blue;cursor:hand;' title='"&rs("userfax")&"'>传真</span>"
end if
%>
</td>
</tr>
<tr>
<td height="1" colspan="3" bgcolor="#CCCCCC"></td>
</tr>
<tr bgcolor="#6699cc">
<td height="32" align="center"> </td>
<td colspan="2" bgcolor="#6699cc" style="LEFT: 0px; WIDTH: 550; WORD-WRAP: break-word;color:#003366">
<%=rs("sendinfo")%>
<%
if rs("reply")<>"" then
response.write"<span style='color:black'><br><b>管理员 "&rs("realname")&" 在"&rs("replytime")&"的回复:</b>"&rs("reply")&"</span>"
end if
%> </td>
</tr>
</table></td>
</tr>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
</table>
<br>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" class="box">
<tr>
<td height="25" align="center">共有<%=rc%>条留言,页次:<%=page%>/<%=pgnm%>
<%if page>1 and pgnm>1 then%>
<a href="?page=1">第一页</a>
<a href="?page=<%=page-1%>">上一页</a>
<%
end if
if page<pgnm and pgnm>1 then
%>
<a href="?page=<%=page+1%>">下一页</a>
<a href="?page=<%=pgnm%>">最未页</a>
<%end if%></td>
</tr>
</table>
<br>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" class="box">
<tr bgcolor="#006699">
<td height="30" colspan="4" style="color:white"><strong> 添加留言:</strong></td>
</tr>
<form name="form1" method="post" action="<%=filename%>?action=add">
<tr>
<td height="5" colspan="4"></td>
</tr>
<tr>
<td width="43" height="20" align="center">姓名:</td>
<td width="312">
<input name="username" type="text" id="username">
*
</td>
<td width="53" align="center">电话:</td>
<td width="190"><input name="usertel" type="text" id="usertel"></td>
</tr>
<tr>
<td height="20" align="center">地址:</td>
<td><input name="useraddress" type="text" id="useraddress">
*</td>
<td align="center">传真:</td>
<td><input name="userfax" type="text" id="userfax"></td>
</tr>
<tr>
<td height="20" align="center">邮箱:</td>
<td><input name="usermail" type="text" id="usermail"></td>
<td align="center">主页:</td>
<td><input name="userhome" type="text" id="userhome"></td>
</tr>
<tr>
<td height="20" align="center">留言:</td>
<td height="100" colspan="3" rowspan="2"><textarea name="sendinfo" id="sendinfo" style="width:500;height:80"></textarea>
*</td>
</tr>
<tr>
<td height="70" align="center"> </td>
</tr>
<tr>
<td height="30" colspan="4" align="center"><input name="reset" type="reset" id="reset" value=" 重新输入 ">
<input type="submit" name="Submit" value=" 添加留言 "></td>
</tr>
</form>
</table>
<br>
<%
end select
%>
</body>
</html>
</td>
<td align="left" width="4" background="images/sidebox-content-right.gif"><img src="images/sidebox-content-right.gif" width="4" height="1" alt=""></td>
</tr>
</table>
</td>
<table width="780" cellpadding="0" cellspacing="0" border="0" align="center">
<tr valign="top">
<td><img src="images/column-footer.gif" width="780" height="16" border="0" alt=""></td>
</tr>
</table>
<table width="780" cellpadding="0" cellspacing="0" border="0" align="center">
<tr valign="top">
<td><img src="images/footer.gif" width="780" height="20" border="0" alt=""></td>
</tr>
</table>
<!-- footer -->
<table width="780" cellpadding="0" cellspacing="0" border="0" align="center">
<tr align="center">
<td width="100%" colspan="3">
<%
set rs=server.createobject("adodb.recordset")
sql="select top 1 copyright from system order by id desc"
rs.open sql,db,1,1
%>
<%=rs("copyright")%>
<% rs.close %>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -