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

📄 create_soft_top.asp

📁 动感系统XP Access版,服务器需要安装Jmail 组件 配置SendMessages.asp 最后部分的参数
💻 ASP
字号:
<!-- #include file="conn.asp" -->
<!-- #include file="inc/const.asp" -->
<!-- #include file="inc/function.asp" -->
<HTML><HEAD><TITLE>后台管理 </TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="admin.css" type=text/css rel=stylesheet>
</HEAD>
<BODY leftMargin=0 topMargin=0>
<!-- #include file="admin_header.asp" -->
<table width="100%" border="0" cellspacing="2">
  <tr>
    <td width="20%" align="center" valign="top" class="tdbgleft"><!-- #include file="Admin_Left.asp" --></td> 
    <td  class="b1" valign="top">
<% Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set Rs=server.createobject("adodb.recordset")
Server.ScriptTimeOut=9999999
dim fso,CateRs,HtmlFileName,HtmlTemplate,HtmlContent,listContent,i
dim strTitle,strNavigate,strSoftList,strOrderName,strAction

   'Set CateRs=server.createobject("adodb.recordset")
   
  '读取默认模板
   sql="select ID,Header,Footer,Normal_htm from SoftDown_Template where isActive=true"
   rs.open sql,conn,1,1 
   if rs.eof and rs.bof then
   		response.write "您没有添加模板,或者没有设置默认模板。"
		response.end
   else
   HtmlTemplate=rs("Header")&rs("Normal_htm")&rs("Footer")
   end if
   rs.close  
   
if not isnull(cUserName) or cUserName<>"" then
   if chkMaster(cUserName) then  
   
      call main()

    else
	  msgtitle="批量生成下载排行榜软件列表"
      msginfo="<li>操作错误,你不是系统管理员,没有权限进行此项操作!</li>" 
	end if
 else
    msgtitle="批量生成下载排行榜软件列表"
    msginfo="<li>操作错误,你没有登录系统!<li><a href=""User.Asp"">点此登录系统</a></li>" 
    call Sysmsg(msgtitle,msginfo) 
end if

  Set Rs=nothing
  Set fso=nothing

sub main()
   	  
      msgtitle="批量生成下载排行榜软件列表"
          msginfo=Create_Top(100,20,"AllHits")
	  msginfo=msginfo&Create_Top(100,20,"DayHits")
	  msginfo=msginfo&Create_Top(100,20,"WeekHits")
	  msginfo=msginfo&Create_Top(100,20,"MonthHits")	  
      call Sysmsg(msgtitle,msginfo) 

end sub

function Create_Top(intTop,MaxPerPage,strOrderName)
    select case strOrderName
	       case "AllHits"
           strAction="全部下载排行榜"
		   case "DayHits"
		   strAction="本日下载排行榜"
		   case "WeekHits"
		   strAction="本周下载排行榜"
		   case "MonthHits"
		   strAction="本月下载排行榜"
		   case else
		   straction=""
	end select
	
strTitle=strAction
strNavigate="<a href=""../"">软件下载</a> → <font color=""red""><b>"&strAction&"</b></font></td>"
strNavigate=strNavigate & "<td align=""right""><a href=""Top_DayHits_1.html"" class=""ArticleList"">本日下载排行榜</a> | <a href=""Top_WeekHits_1.html"" class=""ArticleList"">本周下载排行榜</a> | <a href=""Top_MonthHits_1.html"" class=""ArticleList"">本月下载排行榜</a> | <a href=""Top_AllHits_1.html"" class=""ArticleList"">全部下载排行榜</a>"

sql="select Top "&intTop&" SoftID,SoftName,SoftVer,Content,SoftSize,SoftTime,SoftType,WeekHits,MonthHits,AllHits,Rank from SoftDown_SoftInfo "
sql=sql&" order by "&strOrderName&" desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then 
    strSoftList = strSoftList & "<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"">" & vbcrlf
    strSoftList = strSoftList & "  <tr>" & vbcrlf
    strSoftList = strSoftList & "    <td height=""50"" align=""center"">Sorry!没有任何软件</td>" & vbcrlf
    strSoftList = strSoftList & "  </tr>" & vbcrlf
    strSoftList = strSoftList & "</table>" & vbcrlf
		
    HtmlContent=HtmlTemplate
    HtmlContent=replace(HtmlContent,"$Title$",""&strTitle&"")
    HtmlContent=replace(HtmlContent,"$Navigate$",""&strNavigate&"")
    HtmlContent=replace(HtmlContent,"$ShowContent$",""&strSoftList&"")
    HtmlContent=replace(HtmlContent,"</HEAD>","</HEAD>"&Copyright&"")

    HtmlFileName=Server.MapPath("SoftList/Top_"&strOrderName&"_1.html")
    Set fout = fso.CreateTextFile(HtmlFileName)
    fout.WriteLine HtmlContent 
    fout.close:set fout = nothing 
else

    totalPut=rs.recordcount  '软件数
	        if (totalPut mod MaxPerPage)=0 then 
	     			tempPcount= totalPut \ MaxPerPage 
	   		else 
	      			tempPcount= totalPut \ MaxPerPage + 1 
	   		end if 
	
		for CurrentPage=1 to tempPcount
		
		    if (totalPut mod MaxPerPage)=0 then 
	     			Pcount= totalPut \ MaxPerPage 
	   		else 
	      			Pcount= totalPut \ MaxPerPage + 1 
	   		end if 
	
    listContent=""
    listContent = listContent & "<table width=""100%"" border=0 cellpadding=5 cellspacing=1 bgcolor=""#CCCCCC"" id=""TbSoftList"">" & vbcrlf
    listContent = listContent & "  <tr align=""center"" bgcolor=""#F5F5F5""> " & vbcrlf
    listContent = listContent & "    <td>软件名称</td>" & vbcrlf
    listContent = listContent & "    <td nowrap>整理日期</td>" & vbcrlf
    listContent = listContent & "    <td nowrap>软件大小</td>" & vbcrlf
    listContent = listContent & "    <td nowrap>软件类型</td>" & vbcrlf
    listContent = listContent & "    <td nowrap>本周下载</td>" & vbcrlf
    listContent = listContent & "    <td nowrap>本月下载</td>" & vbcrlf
    listContent = listContent & "    <td nowrap>全部下载</td>" & vbcrlf
    listContent = listContent & "    <td nowrap>软件等级</td>" & vbcrlf
    listContent = listContent & "  </tr>" & vbcrlf
    listContent = listContent & "  <tr align=""center"" bgcolor=""#F5F5F5""> " & vbcrlf
    listContent = listContent & "    <td colspan=""8"" nowrap>$showPage$</td>" & vbcrlf
    listContent = listContent & "  </tr>" & vbcrlf
    RS.MoveFirst
	if currentpage > Pcount then currentpage = Pcount
   	if currentpage<1 then currentpage=1
	RS.Move (currentpage-1) * MaxPerPage
	page_count=0	
	do while not rs.eof and page_count < Clng(MaxPerPage)
	listContent = listContent & "  <tr bgcolor=""#FFFFFF""> " & vbcrlf
	listContent = listContent & "    <td width=""50%""><font face=Wingdings color=#42A5F7>v</font> <a href=""../SoftView/SoftView_"&rs("SoftID")&".html""><b>"&rs("SoftName")&" "&rs("SoftVer")&"</b></a></td>" & vbcrlf
	listContent = listContent & "    <td align=""center"" nowrap>"&FormatDateTime(rs("SoftTime"),2)&"</td>" & vbcrlf
	listContent = listContent & "    <td align=""center"" nowrap>"
  if rs("SoftSize")>1024 then 
	 listContent = listContent & (round(rs("SoftSize")/1024,2)&" MB")
  else
	 listContent = listContent & (rs("SoftSize")&" KB") 
  end if
	listContent = listContent & "</td>" & vbcrlf
	listContent = listContent & "    <td align=""center"" nowrap>"&rs("SoftType")&"</td>" & vbcrlf
	listContent = listContent & "    <td align=""center"" nowrap>"
    if strOrderName="WeekHits" then
	listContent = listContent & "<font color=""red""><b>"&rs("WeekHits")&"</b></font>"
	else
	listContent = listContent & rs("WeekHits")
	end if
	listContent = listContent & "</td>" & vbcrlf
	listContent = listContent & "    <td align=""center"" nowrap>"
    if strOrderName="MonthHits" then
	listContent = listContent & "<font color=""red""><b>"&rs("MonthHits")&"</b></font>"
	else
	listContent = listContent & rs("MonthHits")
	end if
	listContent = listContent & "</td>" & vbcrlf
	listContent = listContent & "    <td align=""center"" nowrap>"
    if strOrderName="AllHits" then
	listContent = listContent & "<font color=""red""><b>"&rs("AllHits")&"</b></font>"
	else
	listContent = listContent & rs("AllHits")
	end if
	listContent = listContent & "</td>" & vbcrlf
	listContent = listContent & "    <td align=""center"" nowrap>"
    listContent = listContent & "<img src=""../images/"&trim(rs("Rank"))&"star.gif"">"
	listContent = listContent & "</td>" & vbcrlf
	listContent = listContent & "  </tr>" & vbcrlf
	listContent = listContent & "  <tr bgcolor=""#FFFFFF""> " & vbcrlf
	listContent = listContent & "    <td colspan=""8"">·"
  if len(trim(rs("Content")))>148 then
     listContent = listContent & left(trim(rs("Content")),145)&"..."& vbcrlf
  else
     listContent = listContent & trim(rs("Content"))& vbcrlf
  end if
	listContent = listContent & "</td>" & vbcrlf
	listContent = listContent & "  </tr>" & vbcrlf
  page_count=page_count+1
		rs.movenext
	loop
'end if
    listContent = listContent & "  <tr align=""center"" bgcolor=""#F5F5F5""> " & vbcrlf
    listContent = listContent & "    <td colspan=""8"" nowrap>$showPage$</td>" & vbcrlf
    listContent = listContent & "  </tr>" & vbcrlf
    listContent = listContent & "</table>" & vbcrlf

    strSoftList=replace(listContent,"$showPage$",""&showPage(totalput,MaxPerPage,currentPage,strOrderName)&"") 
	
	HtmlContent=HtmlTemplate
    HtmlContent=replace(HtmlContent,"$Title$",""&strTitle&"")
    HtmlContent=replace(HtmlContent,"$Navigate$",""&strNavigate&"")
    HtmlContent=replace(HtmlContent,"$ShowContent$",""&strSoftList&"")
    HtmlContent=replace(HtmlContent,"</HEAD>","</HEAD>"&Copyright&"")

    HtmlFileName=Server.MapPath("SoftList/Top_"&strOrderName&"_"&currentPage&".html")
    Set fout = fso.CreateTextFile(HtmlFileName)
    fout.WriteLine HtmlContent 
    fout.close:set fout = nothing 
					
		next 
end if
rs.close
	Create_Top="成功创建"&strAction&"软件列表网页,<a href=""SoftList/Top_"&strOrderName&"_1.html"" target=""_blank"">点此查看网页</a>。<br>"& vbcrlf
end function

function showPage(TotalNumber,MaxPerPage,currentPage,strOrderName)
showPage=""
    select case strOrderName
	       case "AllHits"
           strAction="全部下载排行榜"
		   case "DayHits"
		   strAction="本日下载排行榜"
		   case "WeekHits"
		   strAction="本周下载排行榜"
		   case "MonthHits"
		   strAction="本月下载排行榜"
		   case else
		   straction=""
	end select
  	if totalnumber mod maxperpage=0 then
     		n= totalnumber \ maxperpage
  	else
     		n= totalnumber \ maxperpage+1
  	end if
	
	showPage=showPage & "<table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0"">"
  	showPage=showPage & "<tr><td align=""center""><font color=""red"">"&strAction&"</font> "

  	if CurrentPage<2 then
    	showPage=showPage &"<font color=""red""><b>"&totalnumber&"</b></font> 个软件 |  首页 上一页"
  	else
    	showPage=showPage &"<font color=""red""><b>"&totalnumber&"</b></font> 个软件 |  <a href=""Top_"&strOrderName&"_1.html"">首页</a>"
    	showPage=showPage &" <a href=""Top_"&strOrderName&"_"&CurrentPage-1&".html"">上一页</a>"
  	end if

  	if n-currentpage<1 then
    	showPage=showPage &" 下一页 尾页"
  	else
    	showPage=showPage &" <a href=""Top_"&strOrderName&"_"&(CurrentPage+1)&".html"">"
    	showPage=showPage &" 下一页</a> <a href=""Top_"&strOrderName&"_"&n&".html"">尾页</a>"
  	end if
   	showPage=showPage &"  页次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
    showPage=showPage &"<b>"&maxperpage&"</b>个软件/页 </td>"
	
	showPage=showPage &"<form action="""" method=post onChange=""submit()""><td align=""center"">转到:<select name=""select"" onChange='javascript:window.open(this.options[this.selectedIndex].value,""_top"")'>"
	for intPage=1 to n
	showPage=showPage &"<option value=""Top_"&strOrderName&"_"&intPage&".html"""
	if intPage=CurrentPage then showPage=showPage &" selected"
	showPage=showPage &">第"&intPage&"页</option>"
	next
	showPage=showPage &"</select></td></FORM></tr></table>"
end function
%>
    </td>
  </tr>
</table>
<!-- #include file="admin_footer.asp" -->
</BODY></HTML>
<%
 CloseDatabase %>

⌨️ 快捷键说明

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