📄 create_soft_commend.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
'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_Commend(12)
call Sysmsg(msgtitle,msginfo)
end sub
function Create_Commend(MaxPerPage)
strTitle="下载推荐"
strNavigate="<a href=""../"">软件下载</a> → 下载推荐"
sql="select SoftID,SoftName,SoftVer,Content,SoftSize,SoftTime,System,LicenceType,images from SoftDown_SoftInfo where images<>''"
sql=sql&" order by SoftTime 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(FolderPath&"Commend_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 align=""center"" cellpadding=5 cellspacing=1>" & vbcrlf
listContent = listContent & " <tr bgcolor=""#EFEFEF""> " & vbcrlf
listContent = listContent & " <td colspan=""2"" align=""center"">$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> " & vbcrlf
listContent = listContent & " <td width=""28%"" align=""center""><a href=""../SoftView/SoftView_"&rs("SoftID")&".html"" title="""&rs("SoftName")&" "&rs("SoftVer")&"""><img src=""../"&rs("images")&""" border=0 width=140 height=130></a></td>" & vbcrlf
listContent = listContent & " <td> <table width=""100%"" border=""0"" cellspacing=""1"" cellpadding=""3"">" & vbcrlf
listContent = listContent & " <tr> " & vbcrlf
listContent = listContent & " <td width=""15%"" bgcolor=""#EFEFEF"" align=""center"">软件名称:</td>" & vbcrlf
listContent = listContent & " <td colspan=""3""><a href=""../SoftView/SoftView_"&rs("SoftID")&".html"" class=""ArticleList""><b>"&rs("SoftName")&" "&rs("SoftVer")&"</b></a></td>" & vbcrlf
listContent = listContent & " </tr>" & vbcrlf
listContent = listContent & " <tr> " & vbcrlf
listContent = listContent & " <td width=""15%"" bgcolor=""#EFEFEF"" align=""center"">整理日期:</td>" & vbcrlf
listContent = listContent & " <td width=""40%"">"&FormatDateTime(rs("SoftTime"),2)&"</td>" & vbcrlf
listContent = listContent & " <td width=""15%"" bgcolor=""#EFEFEF"" align=""center"">软件大小:</td>" & vbcrlf
listContent = listContent & " <td width=""30%"">"
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 & " </tr>" & vbcrlf
listContent = listContent & " <tr> " & vbcrlf
listContent = listContent & " <td width=""15%"" bgcolor=""#EFEFEF"" align=""center"">运行平台:</td>" & vbcrlf
listContent = listContent & " <td width=""40%"">"&rs("system")&"</td>" & vbcrlf
listContent = listContent & " <td width=""15%"" bgcolor=""#EFEFEF"" align=""center"">授权方式:</td>" & vbcrlf
listContent = listContent & " <td width=""30%"">"&rs("LicenceType")&"</td>" & vbcrlf
listContent = listContent & " </tr>" & vbcrlf
listContent = listContent & " <tr> " & vbcrlf
listContent = listContent & " <td colspan=""4""> · "
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
listContent = listContent & " </table></td>" & vbcrlf
listContent = listContent & " </tr>" & vbcrlf
listContent = listContent & " <tr> " & vbcrlf
listContent = listContent & " <td height=""1"" background=""images/bgline.gif"" colspan=""2"" ></td>" & vbcrlf
listContent = listContent & " </tr>" & vbcrlf
page_count=page_count+1
rs.movenext
loop
'end if
listContent = listContent & " <tr bgcolor=""#EFEFEF""> " & vbcrlf
listContent = listContent & " <td colspan=""2"" align=""center"">$showPage$</td>" & vbcrlf
listContent = listContent & " </tr>" & vbcrlf
listContent = listContent & "</table>" & vbcrlf
strSoftList=replace(listContent,"$showPage$",""&showPage(totalput,MaxPerPage,currentPage)&"")
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/Commend_"¤tPage&".html")
Set fout = fso.CreateTextFile(HtmlFileName)
fout.WriteLine HtmlContent
fout.close:set fout = nothing
next
end if
rs.close
Create_Commend="成功创建下载推荐软件列表网页,<a href=""SoftList/Commend_1.html"" target=""_blank"">点此查看网页</a>。"& vbcrlf
end function
function showPage(TotalNumber,MaxPerPage,currentPage)
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"">推荐下载软件</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=""Commend_1.html"">首页</a>"
showPage=showPage &" <a href=""Commend_"&CurrentPage-1&".html"">上一页</a>"
end if
if n-currentpage<1 then
showPage=showPage &" 下一页 尾页"
else
showPage=showPage &" <a href=""Commend_"&(CurrentPage+1)&".html"">"
showPage=showPage &" 下一页</a> <a href=""Commend_"&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=""Commend_"&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 + -