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

📄 index.asp

📁 新的文章管理系统
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="const.asp"-->
<%
	dim rs,sql
	dim classid
	dim classname
   	dim totalPut   
   	dim CurrentPage
   	dim TotalPages
	call getConst()
   	if request("classid")<>"" then
		classid=request("classid")
   	else
		classid=1
   	end if
   	if not isempty(request("page")) then
      		currentPage=cint(request("page"))
   	else
      		currentPage=1
   	end if
  	set rs = server.createobject("adodb.recordset")
 	set rs1=server.createobject("adodb.recordset")
   	if trim(request("Nclassid"))<>"" then
		Nclassid=trim(request("Nclassid"))
  		sql="select * from ANclass where NclassID="&cstr(Nclassid)
 		rs.open sql,conn,1,1
 		if not rs.eof then
			Nclassname=rs("Nclass")
 		end if
		rs.close
   	else
		Nclassid=""
		Nclassname="全部文章"
   	end if
  	sql="select * from Aclass where classID="&cstr(classid)
 	rs.open sql,conn,1,1
 	if not rs.eof then
		classname=rs("class")
 	end if
	rs.close
%>
<html>
<head>
<meta NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=gb2312">
<meta name="keywords" content="<%=NetName%>,<%=NetUrl%>">
<LINK href="style.css" rel=stylesheet>
<title><%=classname%>|<%=NetUrl%></title>
<script src="alt.js"></script>
<script src="popwin2.js"></script>
</head>
<body <%=BodyVar%>>
<table width="95%" border="0" align=center>
  <tr>
    <td width="26%"><%=Logo%></td>
    <td width="56%"><%=ads%></td>
    <td width="18%" align="center" valign="middle"> 
      <table width="100%" border="0">
        <tr>
          <td valign="middle"><img src="pic/open.gif" width="14" height="15" align="absmiddle"> 
            <a href="javascript:window.external.AddFavorite('<%=NetUrl%>',%20'<%=NetName%>')">添加收藏</a> 
          </td>
        </tr>
        <tr>
          <td valign="middle"><img src="pic/home.gif" width="16" height="16" align="absmiddle"> 
            <a href="#" onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('<%=NetUrl%>');">设为首页</a> 
          </td>
        </tr>
        <tr>
          <td valign="middle"><img src="pic/mail.gif" width="14" height="15" align="absmiddle"> 
            <a href="mailto:<%=Email%>">联系方式</a> </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

<TABLE cellSpacing=0 cellPadding=0 width="95%" border=0 align=center>
  <TBODY>
  <TR>
    <TD bgColor="<%=Tablebackcolor%>">
      <TABLE cellSpacing=1 cellPadding=4 width="100%" border=0>
        <TR>
          <TD bgColor="<%=Tablebodycolor%>">
<%
	sql="select class,classid from Aclass"
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then
		response.write "还没有任何栏目"
	else
	do while not rs.eof
%>|&nbsp;&nbsp;<a href="default.asp?classid=<%=rs("classid")%>"><%if cint(rs("classid"))=cint(classid) then%><font color=red><%=rs("class")%></font><%else%><%=rs("class")%><%end if%></a>&nbsp;&nbsp;|&nbsp;&nbsp;  
<%  
	rs.movenext  
	loop  
	end if  
	rs.close  
%>  
	</TD></TR>
        <TR>
          <TD bgColor="<%=Tablebody1color%>">
|&nbsp;&nbsp;<%=classname%>>><%if Nclassid="" then%>全部文章<%else%><%=Nclassname%><%end if%>
	</TD></TR>
      </table>
    </td>
  </tr>
  </tbody>
</table>
<br>
<div align="center"><table border="0" width=95% align=center cellspacing="0" cellpadding="1">
    <tr>  
      <td valign="top" width="25%"> 
        <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0 align=center>
  <TBODY>
  <TR>
    <TD bgColor="<%=Tablebackcolor%>">
      <TABLE cellSpacing=1 cellPadding=4 width="100%" border=0>
        <TR>
                  <TD bgColor="<%=Tablebodycolor%>">近期热门文章 </TD>
                </TR>
        <TR>
          <TD bgColor="<%=Tablebody1color%>">
 
<font style=line-height:150%> 
<% 
	sql="SELECT top 10 * FROM article order by hits desc" 
	rs.open sql,conn,1,1 
	if rs.bof and rs.eof then 
		response.write "无更新文章" 
	else 
	do while not rs.eof     
%>     
 <font face=Wingdings color=<%=Tablebodycolor%> size=2>v</font> <a href="javascript:popwin2('list.asp?id=<%=rs("articleid")%>')"  onmouseover="showPopupText" alt="<%=rs("title")%>" target=_top><%if len(rs("title"))>16 then%><%=left(rs("title"),16)%>...<%else%><%=rs("title")%><%end if%></a>[<font color=red><%=rs("hits")%></font>]<br>    
<%    
	rs.movenext     
	loop 
	end if  
	rs.close   
%>    
</font> 

	</TD></TR>
      </table>
    </td>
  </tr>
  </tbody>
</table>
      </td> 
      <td valign="top" width="3%">&nbsp;    
      </td> 
      <td width="72%" valign="top">   
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0 align=center>
  <TBODY>
  <TR>
    <TD bgColor="<%=Tablebackcolor%>">
      <TABLE cellSpacing=1 cellPadding=4 width="100%" border=0>
        <TR>
                  <TD bgColor="<%=Tablebodycolor%>"><%if Nclassid="" then%>
                    <%=Nclassname%>>> 
                    <%
	sql="select * from ANclass where classid="&classid
	rs.open sql,conn,1,1
	do while not rs.eof
		response.write "&nbsp;<a href=index.asp?classid="&classid&"&Nclassid="&rs("Nclassid")&">"&rs("Nclass")&"</a>"
	rs.movenext
	loop
	rs.close
else
%>
                    <%=Nclassname%>
                    <%
	sql="select * from ANclass where Nclassid<>"&Nclassid&" and classid="&classid
	rs.open sql,conn,1,1
	do while not rs.eof
		response.write "&nbsp;<a href=index.asp?classid="&classid&"&Nclassid="&rs("Nclassid")&">"&rs("Nclass")&"</a>"
	rs.movenext
	loop
	rs.close
%>
                    <%end if%>
                  </TD>
                </TR>
        <TR>
          <TD bgColor="<%=Tablebody1color%>">
<font style=line-height:150%> 
<% 
   	if Nclassid<>"" then
sql="select * from article where Nclassid="+cstr(Nclassid)+" and classid="+cstr(classid)+"  order by articleid desc" 
	else
sql="select * from article where classid="+cstr(classid)+" order by articleid desc" 
	end if
	rs.open sql,conn,1,1 
  	if rs.eof and rs.bof then 
       		response.write "<p align='center'>没有或没有找到任何文章</p>" 
   	else 
      		MaxPerPage=PageCount
			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 
            			showContent 
             			showpage totalput,MaxPerPage,"index.asp" 
        		else 
	        		currentPage=1 
           			showContent 
           			showpage totalput,MaxPerPage,"index.asp" 
	      		end if 
	   	end if 
   	rs.close 
   	end if 
	         
   	sub showContent 
       	dim i 
	   	i=0 
	do while not rs.eof
%><font face=Wingdings color=<%=Tablebodycolor%> 
            size=4.5>2</font><%=i+1%>. 
<a href="javascript:popwin2('list.asp?id=<%=rs("articleid")%>')" onmouseover="showPopupText" alt="<%=rs("title")%>"><%=rs("title")%></a> 
(<%if rs("dateandtime")=date() then%><font color=red><%=month(rs("dateandtime"))%>月<%=day(rs("dateandtime"))%>日</font><%else%><font color='#999999'><%=month(rs("dateandtime"))%>月<%=day(rs("dateandtime"))%>日</font><%end if%>,<font color=green><%=rs("hits")%></font>) 
<br> 
<% 
	i=i+1
	if i>=MaxPerPage then exit do
	rs.movenext 
	loop 
	end sub
%> 
</font> 
<!--#include file=query.asp-->
	</TD></TR>
      </table>
    </td>
  </tr>
  </tbody>
</table>
      </td> 
    </tr>                            
  </table>                            
 </div>
    <%
	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&"?classid="&request("classid")&"&Nclassid="&request("Nclassid")&">"
  	response.write "<font color='red'>"&Nclassname&"</font>"

  	if CurrentPage<2 then
    		response.write "共"&totalnumber&"篇&nbsp;首页 上一页&nbsp;"
  	else
    		response.write ""&totalnumber&"个&nbsp;<a href="&filename&"?page=1&classid="&request("classid")&"&Nclassid="&request("Nclassid")&">首页</a>&nbsp;"
    		response.write "<a href="&filename&"?page="&CurrentPage-1&"&classid="&request("classid")&"&Nclassid="&request("Nclassid")&">上一页</a>&nbsp;"
  	end if

  	if n-currentpage<1 then
    		response.write "下一页 尾页"
  	else
    		response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&classid="&request("classid")&"&Nclassid="&request("Nclassid")&">"
    		response.write "下一页</a> <a href="&filename&"?page="&n&"&classid="&request("classid")&"&Nclassid="&request("Nclassid")&">尾页</a>"
  	end if
   	response.write "&nbsp;页次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
    	response.write "&nbsp;<b>"&maxperpage&"</b>篇文章/页 "
%>
转:<select name='page' size='1' onchange='javascript:submit()'>   
              <%for i = 1 to n%>   
              <option value='<%=i%>' <%if cint(Page)=cint(i) then%> selected <%end if%>>第<%=i%>页</option>   
              <%next%>   
            </select>
</form>
<%     
end function

   	set rs=nothing   
	conn.close
	set conn=nothing
%> 
<!--#include file="copyright.inc" -->
                       
</body>                              
</html>                              

⌨️ 快捷键说明

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