📄 create_soft_news.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">
<%
Server.ScriptTimeOut=9999999
dim fso,CateRs,HtmlFileName,HtmlTemplate,HtmlContent,listContent,i,n,MaxPerPage,totalPut,CurrentPage,TotalPages
dim strTitle,strNavigate,strDayDownTop,strWeekDownTopm,strSoftList,intAction,strAction,intTop,TypeSQL
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set Rs=server.createobject("adodb.recordset")
'Set CateRs=server.createobject("adodb.recordset")
'读取默认模板
sql="select ID,Header,Footer,Normal_htm from "&CategoryName&"_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
Response.Write Create_News(40,0,"全部软件",200)&"<br>"
for iii=0 to ubound(SoftType)
Response.Write Create_News(40,cint(iii+1),Trim(SoftType(iii)),200)&"<br>"
next
Set Rs=nothing
Set fso=nothing
function Create_News(MaxPerPage,intAction,strAction,intTop)
strTitle=""
strSoftList=""
strTitle="最新更新 → "&SoftTypeName
strNavigate = "<a href=""../"">软件下载</a> >> <font color=""#FF0000""><strong>"&strAction&"</strong></font> 最近更新"
strNavigate = strNavigate & "</td><form action="""" method=post onChange=""submit()"">" & vbcrlf
strNavigate = strNavigate & "<td bgcolor=""#FFFFFF"">转到:<select name=""select"" onChange='javascript:window.open(this.options[this.selectedIndex].value,""_top"")'>" & vbcrlf
strNavigate = strNavigate & "<option value=""News_0_1.html"">全部软件</option> " & vbcrlf
for i=0 to ubound(SoftType)
strNavigate = strNavigate & "<option value=""News_"&i+1&"_1.html"""
if i+1= intAction then strNavigate = strNavigate & " selected"
strNavigate = strNavigate & ">"&SoftType(i)&"</option> " & vbcrlf
next
strNavigate = strNavigate & "</select></td></FORM>"
if intAction=0 then
TypeSQL="SELECT top "&intTop&" SoftID,SoftName,SoftVer,CatalogID,CatalogName,SoftSize,SoftTime,Rank,isCommend,isTop FROM SoftDown_SoftInfo order by SoftTime desc,SoftID desc"
else
TypeSQL="SELECT top "&intTop&" SoftID,SoftName,SoftVer,CatalogID,CatalogName,SoftSize,SoftTime,Rank,isCommend,isTop FROM SoftDown_SoftInfo where SoftType='"&strAction&"' order by SoftTime desc,SoftID desc"
end if
rs.open TypeSQL,conn,1,1
if rs.eof and rs.bof then
strSoftList = strSoftList & "<table width=""100%"" border=""0"" cellpadding=""3"" cellspacing=""1"" bgcolor=""#CCCCCC"" id=""TbSoftList"">" & vbcrlf
strSoftList = strSoftList & " <tr align=""center"" bgcolor=""#F5F5F5""> " & vbcrlf
strSoftList = strSoftList & " <td height=""22"">软件名称</td>" & vbcrlf
strSoftList = strSoftList & " <td height=""22"">更新时间</td>" & vbcrlf
strSoftList = strSoftList & " <td height=""22"">软件大小</td>" & vbcrlf
strSoftList = strSoftList & " <td height=""22"">软件等级</td>" & vbcrlf
strSoftList = strSoftList & " </tr>" & vbcrlf
strSoftList = strSoftList & " <tr align=""center""> " & vbcrlf
strSoftList = strSoftList & " <td colspan=""4"" bgcolor=""#FFFFFF"">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/News_"&intAction&"_1.html")
Set fout = fso.CreateTextFile(HtmlFileName)
fout.WriteLine HtmlContent
fout.close:set fout = nothing
else
'MaxPerPage,totalPut,CurrentPage,TotalPages
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=""3"" cellspacing=""1"" bgcolor=""#CCCCCC"" id=""TbSoftList"">" & vbcrlf
listContent = listContent & " <tr align=""center"" bgcolor=""#F5F5F5""> " & vbcrlf
listContent = listContent & " <td height=""22"">软件名称</td>" & vbcrlf
listContent = listContent & " <td height=""22"">更新时间</td>" & vbcrlf
listContent = listContent & " <td height=""22"">软件大小</td>" & vbcrlf
listContent = listContent & " <td height=""22"">软件等级</td>" & vbcrlf
listContent = listContent & " </tr>" & vbcrlf
listContent = listContent & " <tr align=""center""> " & vbcrlf
listContent = listContent & " <td colspan=""4"" bgcolor=""#FFFFFF"">$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> "
if rs("isTop") then
listContent = listContent & "<img src=""../images/isTop.gif"" align=""absmiddle""> "
elseif rs("isCommend") then
listContent = listContent & "<img src=""../images/isHot.gif"" align=""absmiddle""> "
else
listContent = listContent & "<img src=""../images/isList.gif"" align=""absmiddle""> "
end if
listContent = listContent & "[<A href=""Catalog_"&rs("CatalogID")&"_SoftTime_Desc_1.html"" target=""_blank"">"&trim(rs("CatalogName"))&"</a>] <A href=""../SoftView/SoftView_"&rs("SoftID")&".html"" title=""" & trim(rs("SoftName"))& " "& trim(rs("SoftVer")) & """ target=""_blank"">" & trim(rs("SoftName"))& " "& trim(rs("SoftVer")) & "</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>"
listContent = listContent & "<img src=""../images/"&rs("Rank")&"star.gif"">"
listContent = listContent & "</td>" & vbcrlf
listContent = listContent & " </tr>" & vbcrlf
page_count=page_count+1
rs.movenext
loop
listContent = listContent & " <tr align=""center""> " & vbcrlf
listContent = listContent & " <td colspan=""4"" bgcolor=""#FFFFFF"">$showPage$</td>" & vbcrlf
listContent = listContent & " </tr>" & vbcrlf
listContent = listContent & " </table>" & vbcrlf
strSoftList=replace(listContent,"$showPage$",""&showPage(intAction,strAction,totalput,MaxPerPage)&"")
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/News_"&intAction&"_"¤tPage&".html")
Set fout = fso.CreateTextFile(HtmlFileName)
fout.WriteLine HtmlContent
fout.close:set fout = nothing
next
end if
rs.close
Create_News="操作成功!"
end function
function showPage(intAction,strAction,TotalNumber,MaxPerPage)
showPage=""
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=""News_"&intAction&"_1.html"">首页</a>"
showPage=showPage &" <a href=""News_"&intAction&"_"&CurrentPage-1&".html"">上一页</a>"
end if
if n-currentpage<1 then
showPage=showPage &" 下一页 尾页"
else
showPage=showPage &" <a href=""News_"&intAction&"_"&(CurrentPage+1)&".html"">"
showPage=showPage &" 下一页</a> <a href=""News_"&intAction&"_"&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=""News_"&intAction&"_"&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 + -