📄 index.asp
字号:
<!--#include file="conn.asp"-->
<title>请您留言</title>
<%
function encode(str)
str = Replace(str, "<br>", "[br]")
str = Replace(str, ">", ">")
str = Replace(str, "<", "<")
str = Replace(str, CHR(32), " ")
str = Replace(str, CHR(9), " ")
str = Replace(str, CHR(34), """)
str = Replace(str, CHR(39), "'")
str = Replace(str, CHR(13), "")
str = Replace(str, CHR(13) & CHR(10), "[br]")
str = Replace(str, CHR(10) & CHR(10), "</P><P>")
str = Replace(str, "[br]", "<BR>")
encode=str
end function
%>
<style type="text/css">
<!--
.style5 {color: #999999}
.style6 {color: #000000}
-->
</style>
<!--<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">-->
<%if request("type")="ly" or request("type")="" then%>
<table class="tb" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="120"><form name="form" method="post" action="index.asp?type=fs">
<table width="100%" height="150" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="48">姓名:
<input name="name" type="text" class="border" size="20" maxlength="12">
来自:<input name="whofrom" type="text" class="border" size="20" maxlength="12"><p>
电话:
<input name="tel" type="text" class="border" size="20" maxlength="12">
Q Q:<input name="qq" type="text" class="border" value="没有可不填" size="20" maxlength="12">
</p>
<p>留言内容:</td>
</tr>
<tr>
<td><textarea name="content" cols="60" rows="5" class="border"></textarea></td>
</tr>
<tr>
<td height="26"><input name="Submit" type="submit" value="提 交" class="box"></td>
</tr>
</table>
</form></td>
</tr>
</table>
<%end if%>
<%if request("type")="fs" then%>
<table width="100%" height="100" border="0" align="center" cellpadding="0" cellspacing="0" class="tb">
<tr>
<td>
<%
dim name,content
if request.form("name")="" then
response.write("<script>alert('请添写您的昵称!');history.go(-1)</script>")
response.end
end if
if request.form("content")="" then
response.write("<script>alert('请添写内容!');history.go(-1)</script>")
response.end
end if
name = replace(trim(request.form("name"))," ","")
whofrom = replace(trim(request.form("whofrom"))," ","")
tel = replace(trim(request.form("tel"))," ","")
qq = replace(trim(request.form("qq"))," ","")
content=replace(trim(request.form("content")),vbcrlf,"[br]")
set rs=server.createobject("adodb.recordset")
sql="select * from book where (id is null)"
rs.open sql,conn,1,3
rs.addnew
rs("name")=name
rs("content")=content
rs("time")=now()
rs("whofrom")=whofrom
rs("tel")=tel
rs("qq")=qq
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<meta http-equiv="refresh" content="1;URL=index.asp">
<table width="88%" border="0" align="center">
<tr>
<td align="center"><p>留言成功 !</p>
<p>1秒中后自动 <font color="#FF0000"><a href="index.asp">返回首页</a></font></p></td>
</tr>
</table></td>
</tr>
</table>
<%end if%>
<%if request("type")="xs" or request("type")="" then
set rs=server.createobject("adodb.recordset") '声明一个记录集
sql="select * from book order by id desc"
rs.open sql,conn,3,2
dim i,pagenum '分页程序代码
i=MaxPerPage '分页数字
rs.pagesize=i
if request.querystring("pagenum")="" or request.querystring("pagenum")=0 then
pagenum=1
else
pagenum=request.querystring("pagenum")
rs.absolutepage=trim(request.querystring("pagenum"))
end if
%>
<%
if rs.eof and rs.bof then '没有留言的时候防止程序错误
%><table width="100%" height="100" border="0" align="center" cellpadding="0" cellspacing="0" class="tb">
<tr>
<td align="center">非常抱歉,暂时没有任何留言!</td>
</tr>
</table>
<%
response.End
end if
%>
<%
do while not rs.eof and i>0
%><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="tb">
<tr>
<td><table width="100%" height="66" border="0" cellpadding="3" cellspacing="1" class="border">
<tr bgcolor="#FFFFFF">
<td width="89%"><table width="100%" border="0" align="center" cellpadding="3" cellspacing="0" style="table-layout:fixed;word-break:break-all;">
<tr>
<td><span class="style6"><b><%= rs("name") %></b>留言的内容:</span><br>
<%=encode(rs("content"))%>
</td>
</tr>
<tr>
<td height="1" bgcolor="#CCCCCC"></td>
</tr>
<tr>
<td height="22" align="right"><span class="style5">来自:<%=rs("whofrom")%>的 <%= rs("name") %> (QQ:<%=rs("qq")%>)</span> <span class="style5">发表于:<%= rs("time") %></span>
</td>
</tr>
</table></td>
</tr><% if rs("re")<>"" then %>
<tr bgcolor="#FFFFFF">
<td><span class="style1">回复:</span><%=encode(rs("re"))%></td>
</tr>
<%end if%>
</table>
<br>
<%
i=i-1
rs.movenext
loop
%></td>
</tr>
</table>
<table class="tb" height="33" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="33">
<%
for p=1 to rs.pagecount '逐个输出分页页面
response.write "<a href=index.asp?pagenum="&p&">"&p&"</a> "
next
%>
<font color="#333333">共有<%=rs.pagecount%>页</font><br></td>
</tr>
</table>
<%rs.close
set rs=nothing
conn.close
set conn=nothing%>
<%end if%>
<table width="100%" height="33" border="0" align="center" cellpadding="0" cellspacing="0" class="tb">
<tr>
<td height="33"> </td>
</tr>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -