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

📄 index.asp

📁 功能完备的留言板 公告管理 用户管理 留言管理 分页 功能的实现 Access数据库
💻 ASP
字号:

<html>
<head> 
<title>计算机系留言薄</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css.css" rel=stylesheet type=text/css></head>


<%


const MaxPerPage=8
dim totalPut
dim CurrentPage
dim TotalPages
dim a,j

if not isempty(request("page")) then
	currentPage=cint(request("page"))
else
	currentPage=1
end if

Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("book.asp")
set rs=server.createobject("adodb.recordset")
sql="select * from message "
rs.open sql,conn,1,1

%>


<body topmargin="8" bgcolor="#FFFFFF">

	<div align="center">
	<table border="0" width="86%" id="table3" height="124" cellspacing="0" cellpadding="0">
		<tr>
			<td height="69">
			<p>
			<img border="0" src="images/top.gif" width="100%" height="100%"></td>
		</tr>
		<tr>
			<td height="8"> </td>
		</tr>
		<tr>
			<td height="12">
			<table border="1" width="100%" id="table4" cellspacing="0" cellpadding="0" height="22" bgcolor="#F4F4FF" bordercolor="#F7F7FF" bordercolorlight="#000000" bordercolordark="#FFFFFF" style="margin-top: 0; margin-bottom: 6">
				<tr>
			<td height="20" width="17%" align="center" style="font-size: 12px"><a href="add.asp">
			签写留言</a></td>
			<td height="20" width="67%" align="center" style="font-size: 12px" >
			<marquee scrolldelay="150" width="378" height="13" ><%=rs("mess")%></marquee></td>
			<td height="20" width="16%" align="center" style="font-size: 12px"><a href="login.asp">
			管理入口</a></td>
				</tr>
			</table>
			</td>
		</tr>
	</table>
	</div>




	<%
	
	set rs=nothing
	conn.close
	set conn=nothing
	Set conn = Server.CreateObject("ADODB.Connection")
	conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("book.asp")

	set rs=server.createobject("adodb.recordset")
	sql="select * from guest order by id desc"
	rs.open sql,conn,1,1
	
	if rs.eof and rs.bof then
		response.write "<p align=center>还 没 有 任 何 留 言</p>"
	else
		totalPut=rs.recordcount
		if currentpage<1 then
			currentpage=1
		end if
		if (currentpage-1)*MaxPerPage>totalput then
			if (totalPut mod MaxPerPage)=0 then
				currentpage=totalPut \ MaxPerPage
			else
				currentpage=totalPut \ MaxPerPage + 1
			end if
		end if
		if currentPage=1 then
			showContent
			showpage totalput,MaxPerPage,"index.asp"
		else
			if (currentPage-1)*MaxPerPage<totalPut then
				rs.move (currentPage-1)*MaxPerPage
				dim bookmark
				bookmark=rs.bookmark
				showContent
				showpage totalput,MaxPerPage,"index.asp"
			else
				currentPage=1
				showContent
				showpage totalput,MaxPerPage,"index.asp"
			end if
		end if
		
		rs.close
	end if
	set rs1=nothing
	set rs=nothing
	conn.close
	set conn=nothing	
	
	
	sub showContent
	do while not rs.eof
	%>
	
	
	<hr noshade width="650" color="#000000" size="1">
	<div align="center">
	<table width="650"  bgcolor="#FFFFFF" border="1" cellspacing="1" cellpadding="0"  bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#FFFFFF">
	  <tr> 
	    <td bgcolor="#FFFFFF" valign="top" rowspan="3" width="110"> 
	      <table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" id="table5">
	        <tr> 
	          <td width="12" height="100%" bgcolor="#FFFFFF"> </td>
	          <td height="100%" valign="top" bgcolor="#FFFFFF"><br>
				姓名:<%=rs("guestname")%> <br>
	           
				 <img src="images/<%=rs("face")%>"> <br>
	            
	            <% if rs("from")<>"" then %>	
	            來自:<%=rs("from")%> 
	            <%end if%>
	          </td>
	        </tr>
	      </table>
	    </td>
	    <td valign="top" height="22"> 
	      <table width="100%" border="0" cellspacing="0" cellpadding="0">
	        <tr> 
	          <td width="10" height="20">         <td height="20"> 
            	<a href="mailto:<%=rs("email")%>"> 
            	<img src="images/EMAIL.GIF" width="45" height="18" border="0" alt="Email:<%=rs("email")%>"></a>&nbsp; 
            	
            	<a href="<%=rs("homepage")%>"> 
            	<img src="images/homepage.gif" width="47" height="18" border="0" alt="http://<%=rs("homepage")%>"></a>&nbsp;&nbsp; 
            	
            	<a href=<% = rs("oicq")%>"> 
            	<img src="images/OICQ.gif" width="50" height="16" border="0" alt="QQ:<%=rs("oicq")%>"></a>&nbsp; 
            	
            	<a href="edit.asp?time=<% =rs("guestdate")%>">
            	<img src="images/EDIT.GIF" width="47" height="18" border="0" alt="签写于:<% =rs("guestdate")%>"></a> 
            
				<img border="0" src="images/ip.gif" width="47" height="18"  alt="IP:<% =rs("ip")%>"> </td>
	        </tr>
	      </table>
	    </td>
	  </tr>
	  <tr> 
	    <td valign="top" height="69"> 
	      <table width="100%" border="0" cellspacing="0" cellpadding="0" height="64">
	        <tr> 
	          <td width="11" bgcolor="#F4F4FF"> </td>
	          <td width="583" bgcolor="#F4F4FF"><br>
	          		<%=rs("guestcontent")%>
	            <br><br>
	            <%if rs("guestreply")<>"" then %>
	            <font color="#000080">回复:</font><font color="#00A800">
	            <font color="#7c7cd3"><%=rs("guestreply")%> </font>
	            <%end if%><br>
	          </td>
        	</tr>
	      </table>
	    </td>
	  </tr>
	  <tr> 
	    <td height="24">&nbsp;&nbsp;发表于:<%=rs("guestdate")%>&nbsp;</td>
	  </tr>
	</table>
	</div>
	
	
	<div align="center">
	<%
		a=a+1
		if a>=MaxPerPage then 
			exit do
		end if
		rs.movenext
		loop 
		
	end sub
	
	%>
 

	<%
		function showpage(totalnumber,maxperpage,filename)
		dim n
		if totalnumber mod maxperpage=0 then
			n=totalnumber \ maxperpage
		else
			n=totalnumber \ maxperpage + 1
		end if
			response.write "<form method=post action="&filename&">"
			response.write " "
		if CurrentPage<2 then
			response.write "<font color='#000080'>首頁 上一頁</font> "
		else
			response.write "<a href="&filename&"?page=1>首頁</a> "
			response.write "<a href="&filename&"?page="&CurrentPage-1&">上一頁</a> "
		end if
		if n-currentpage<1 then
			response.write "<font color='#000080'>下一頁 尾頁</font>"
		else
			response.write "<a href="&filename&"?page="&(CurrentPage+1)&">下一頁</a> "
			response.write "<a href="&filename&"?page="&n&">尾頁</a>"
		end if
			response.write "<font color='#000080'> 共<b>"&totalnumber&"</b>条留言   每頁<b>"&maxperpage&"</b>条留言</font> "
			response.write "<font color='#000080'>转到:</font><input class=smallInput type='text' name='page' size=4 maxlength=10 value="&Currentpage&">"
			response.write "<input class=buttonface type='submit' value='Go' name='cndok'></form>"
		end function
	%>
	</div>

	<div align="center">

	<table border="0" width="85%" id="table2" cellspacing="0" cellpadding="0" height="32">
	<tr>
		<td height="4"></td>
	</tr>
	<tr>
		<td height="15">
	<hr noshade width="650" color="#000000" size="1">
		</td>
	</tr>
	<tr>
		<td>  <!--#include file="bottom.asp"-->
 </td>
	</tr>
</table>
	</div>

</html>

⌨️ 快捷键说明

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