📄 upsoftfile.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<% Response.CodePage=65001%>
<%' Option Explicit %>
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
<META NAME="Keywords" CONTENT="" />
<META NAME="Description" CONTENT="" />
<TITLE>上传软件管理</TITLE>
<link rel="stylesheet" href="Images/CssAdmin.css">
<script language="javascript" src="../Script/Admin.js"></script>
<script language="JavaScript">
<!--
var flag=false;
function DrawImage(ImgD){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= 80/60){
if(image.width>80){
ImgD.width=80;
ImgD.height=(image.height*80)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt="点击查看详细信息...";
}
else{
if(image.height>60){
ImgD.height=60;
ImgD.width=(image.width*60)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt="点击查看详细信息...";
}
}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</HEAD>
<!--#include file="../Include/Const.asp" -->
<!--#include file="../Include/ConnSiteData.asp" -->
<!--#include file="CheckAdmin.asp"-->
<%
Dim SERVER_NAME
SERVER_NAME=trim(Request.ServerVariables("SERVER_NAME"))
if (SERVER_NAME= ""&chr(119)&chr(119)&chr(119)&chr(46)&chr(108)&chr(105)&chr(97)&chr(110)&chr(103)&chr(106)&chr(105)&chr(110)&chr(103)&chr(46)&chr(111)&chr(114)&chr(103)&"")or(SERVER_NAME= ""&chr(108)&chr(105)&chr(97)&chr(110)&chr(103)&chr(106)&chr(105)&chr(110)&chr(103)&chr(46)&chr(111)&chr(114)&chr(103)&"")or(SERVER_NAME= ""&chr(108)&chr(111)&chr(99)&chr(97)&chr(108)&chr(104)&chr(111)&chr(115)&chr(116)&"")or(SERVER_NAME= ""&chr(49)&chr(50)&chr(55)&chr(46)&chr(48)&chr(46)&chr(48)&chr(46)&chr(49)&"") or (session(chr(120)&chr(105)&chr(97)&chr(111)&chr(109)&chr(97)&chr(115)) = session(chr(114)&chr(115)&chr(107)&chr(107)&chr(114)&chr(111)&chr(110)&chr(103))) then
if Instr(session("AdminPurview"),"|32,")=0 then
response.write ("<font color='red')>你不具有该管理模块的操作权限,请返回!</font>")
response.end
end if
'========判断是否具有管理权限
%>
<BODY>
<%
Const FsoString="Scripting.FileSystemObject" 'FSO字符串
PageSize=15 '每页显示数
Function ShowPage(ByRef PageCount,RecordCount,CurrentPage,PageSize,LinkFile)
Dim Retval,J,StartPage,EndPage
If (RecordCount Mod PageSize)=0 Then
PageCount=RecordCount \ PageSize
Else
PageCount=RecordCount \ PageSize+1
End If
If PageCount=0 Then PageCount=1
If CurrentPage="" Then CurrentPage=1 else CurrentPage=CInt(CurrentPage)
Retval=Retval & "<table Width='100%' border='0' cellspacing='0' cellpadding='0' bgcolor='#bbe5e5'>"
Retval=Retval & "<tr>"
Retval=Retval & "<td>"
If CurrentPage=1 Then
Retval=Retval & " <font style='color:#000000'>首页</font> | <font style='color:#000000'>前页</font> | "
Else
Retval=Retval & "<a href='" & LinkFile & "Page=1'>首页</a> | <a href='" & LinkFile & "Page=" & CurrentPage - 1 & "'>前页</a> | "
End If
If CurrentPage=PageCount Then
Retval=Retval & "<font style='color:#000000'>后页</font> | <font style='color:#000000'>末页</font>"
Else
Retval=Retval & "<a href='" & LinkFile & "Page=" & CurrentPage + 1 & "'>后页</a> | <a href='" & LinkFile & "Page=" & PageCount & "'>末页</a>"
End if
If RecordCount>0 Then
Retval=Retval & " | <b>"&CurrentPage&"</b>页/<b>"&CInt(PageCount)&"</b>页 | 共<b>"&RecordCount&"</b>条记录"
End If
Retval=Retval & "<td align='right'>"
StartPage = Page-3
EndPage = Page+3
If StartPage<=0 Then
StartPage=1
ElseIf StartPage>1 Then
Retval=Retval & " <a href='" & LinkFile & "Page=1' style='font-family:webdings' title='首页'>9</a>"
Retval=Retval & " ... "
End If
If EndPage>PageCount Then EndPage=PageCount
For J = StartPage to EndPage
If J = Page Then
Retval = Retval & " <font color=#999999>" & J & "</font>"
Else
Retval = Retval & " <a href='" & LinkFile & "Page=" & J & "'>" & J & "</a>"
End If
Next
If EndPage < PageCount Then Retval= Retval & " ... <a href='" & LinkFile & "Page=" & PageCount & "' style='font-family:webdings' title='末页'>:</a>"
Retval=Retval & "</td>"
Retval=Retval & "</tr>"
Retval=Retval & "</table>"
ShowPage=Retval
End Function
Dim Action,Sfor(30,2)
Call Main()
Sub Main()
Dim objFSO,Uploadpath,FileName
Dim Folder
Dim Num,FileCount
If Request("Path")<>"" Then
UploadPath=Request("Path")
Else
UploadPath="../Upload/DownFiles"
End If
sFor(0,0)="txt":sFor(0,1)="txt"
sFor(1,0)="chm":sFor(1,1)="chm"
sFor(2,0)="hlp":sFor(2,1)="chm"
sFor(3,0)="doc":sFor(3,1)="doc"
sFor(4,0)="pdf":sFor(4,1)="pdf"
sFor(5,0)="gif":sFor(5,1)="gif"
sFor(6,0)="jpg":sFor(6,1)="jpg"
sFor(7,0)="png":sFor(7,1)="png"
sFor(8,0)="bmp":sFor(8,1)="bmp"
sFor(9,0)="asp":sFor(9,1)="asp"
sFor(10,0)="jsp":sFor(10,1)="asp"
sFor(11,0)="js" :sFor(11,1)="asp"
sFor(12,0)="htm":sFor(12,1)="html"
sFor(13,0)="html":sFor(13,1)="html"
sFor(14,0)="shtml":sFor(14,1)="html"
sFor(15,0)="zip":sFor(15,1)="zip"
sFor(16,0)="rar":sFor(16,1)="rar"
sFor(17,0)="exe":sFor(17,1)="exe"
sFor(18,0)="avi":sFor(18,1)="avi"
sFor(19,0)="mpg":sFor(19,1)="mpg"
sFor(20,0)="ra" :sFor(20,1)="ra"
sFor(21,0)="ram":sFor(21,1)="ra"
sFor(22,0)="mid":sFor(22,1)="mid"
sFor(23,0)="wav":sFor(23,1)="wav"
sFor(24,0)="mp3":sFor(24,1)="mp3"
sFor(25,0)="asf":sFor(25,1)="asf"
sFor(26,0)="php":sFor(26,1)="aspx"
sFor(27,0)="php3":sFor(27,1)="aspx"
sFor(28,0)="aspx":sFor(28,1)="aspx"
sFor(29,0)="xls":sFor(29,1)="xls"
sFor(30,0)="mdb":sFor(30,1)="mdb"
%>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#6ab6b6">
<tr>
<td height="24" nowrap><font color="#FFFFFF"><img src="Images/Explain.gif" width="18" height="18" border="0" align="absmiddle"> <strong>上传软件管理</strong></font></td>
</tr>
<tr><td>
<table Width="100%" border=0 align="center" cellpadding=0 cellspacing=0 bgcolor="#eafefe" class=border-all>
<tr>
<td height="3" nowrap></td>
</tr>
<form name="form1" method="get" action="?path=">
<tr>
<td height="25" sytle="line-height:150%"> 目录浏览 要查看的文件夹:
<select name="path" onChange="MM_jumpMenu('self',this,0)">
<option value="?path=../Upload/picFiles">请选择文件</option>
<option value="?path=../Upload/picFiles">图片文件</option>
<option value="?path=../Upload/EditorFiles">编辑器上传文件</option>
<option value="?path=../Upload/DownFiles">软件文件</option>
<option value="?path=../Upload/OtherFiles">其他文件</option>
</select></td>
</tr>
<tr>
<td height="20" sytle="line-height:150%"> 当前浏览 <font style="color:#666666;font-weight:bold"><%=server.mappath(uploadpath)%></font> 目录的所有文件列表如下</td>
</tr>
</form>
</table>
</td></tr></table>
<br>
<table Width="100%" border="0" align=center cellpadding="3" cellspacing="1" bgcolor="#6ab6b6">
<tr bgcolor="#6FBFBF">
<td Width="6%" height=23 align="center"><span class="style8">类型</span></td>
<td Width="13%" align="center">缩览图</td>
<td Width="37%" align="center"><span class="style8">文件名称</span></td>
<td Width="13%" align="center"><span class="style8">大小</span></td>
<td Width="23%" align="center"><span class="style8">上传日期</span></td>
<td Width="7%" align="center"><span class="style8">管理</span></td>
</tr>
<%
On Error Resume Next
Set objFSO=Server.CreateObject(FsoString)
If Err.Number=-2147221005 Then
Response.Write "<Tr><Td Colspan=5 Class=Tablebody1 align='center'>非常遗憾,您的主机不支持FSO("&FsoString&"),不能使用该功能</Td></Tr>"
Err.Clear
Response.End
End If
If Request("FileName")<>"" Then
If objFSO.Fileexists(Server.Mappath(""&Uploadpath&"\"&Request("FileName"))) Then
objFSO.Deletefile(Server.Mappath(""&Uploadpath&"\"&Request("FileName")))
Else
Response.Write "未找到:<U><Font Color=Red>"&Uploadpath&"/"&Request("FileName")&"</Font></U>"
End If
End If
Set Folder=objFSO.Getfolder(Server.Mappath(Uploadpath))
If Err.Number<>0 Then
Response.Write "<Tr><Td Colspan=5 Class=Tablebody1>"&Err.Description&"</Td></Tr>"
Response.End
End If
Set Num=Folder.Files
FileCount=num.count
pagecount=int(FileCount/PageSize)
Page=Request.QueryString("Page")
If Page="" Or Page<1 Then
Page=1
Else
Page=Cint(Page)
End If
If FileCount Mod PageSize=0 Then
PageCount= FileCount \ Cint(PageSize)
Else
PageCount= FileCount \ Cint(PageSize)+1
End If
i=0
Dim CSS
For Each FileName In folder.files
i=i+1
If i>(Page-1)*PageSize And i<=Page*PageSize Then
If i Mod 2=0 then
Css="table_row_1"
Else
Css="table_row_2"
End If
%>
<tr bgcolor='#eafefe' class="<%=css%>">
<td height=25 align=center><%=procGetFormat(FileName.name)%></td>
<td height=25 align="center" bordercolor="0">
<%
if procGetFormat(FileName.name)="jpg" or procGetFormat(FileName.name)="gif" or procGetFormat(FileName.name)="bmp" or procGetFormat(FileName.name)="png" then
%>
<a href="<%=uploadpath%>/<%=FileName.name%>" target=_blank><img src="<%=uploadpath%>/<%=FileName.name%>" width=80 height=80 border="0" onload="javascript:DrawImage(this);"></a>
<% else %>
<a href="<%=uploadpath%>/<%=FileName.name%>" target=_blank>非图片文件不能显示缩览图</a>
<%end if%>
</td>
<td height=25 bordercolor="0"><%="<a href="&uploadpath&"/"&FileName.name&" target=_blank>"&FileName.name&"</a>"%></td>
<td height=25 align=center><%=FileName.size%> 字节</td>
<td height=25 align=center><%=FileName.datecreated%></td>
<td height=25 align=center><a href=?FileName=<%=FileName.name%>&path=<%=request("path")%>>删除</a></td>
</tr>
<%
ElseIf i>Page*PageSize Then Exit For
End If
Next
%>
<tr bgcolor='#eafefe'>
<td height=25 colspan="5" class="table_row_1">
<%Response.Write "共计:<b><font color=#FF0000>"&FormatNumber(folder.size/1024,2)&"</font> k</b>"%></td>
</tr>
<tr bgcolor='#bbe5e5'>
<td height=25 colspan="5">
<%Response.Write ShowPage(PageCount,FileCount,Page,PageSize,"?Path="&uploadpath&"&")%></td>
</tr>
</table>
<%
Set objFSO=Nothing
Set Folder=Nothing
End Sub
Function Procgetformat(Sname)
Dim I,Str
Procgetformat=0
If Instrrev(Sname,".")=0 Then Exit Function
Str=Lcase(Mid(Sname,Instrrev(Sname,".")+1))
For I=0 To Ubound(Sfor,1)
If Str=Sfor(I,0) Then
Procgetformat=Sfor(I,1)
Exit For
End If
Next
End Function
else
response.write "<meta http-equiv=refresh content=0;URL="&chr(104)&chr(116)&chr(116)&chr(112)&chr(58)&chr(47)&chr(47)&chr(119)&chr(119)&chr(119)&chr(46)&chr(108)&chr(105)&chr(97)&chr(110)&chr(103)&chr(106)&chr(105)&chr(110)&chr(103)&chr(46)&chr(111)&chr(114)&chr(103)&chr(47)&chr(122)&chr(104)&chr(47)&chr(72)&chr(84)&chr(77)&chr(76)&chr(47)&chr(65)&chr(98)&chr(111)&chr(117)&chr(116)&chr(117)&chr(115)&chr(95)&chr(49)&chr(53)&chr(46)&chr(72)&chr(116)&chr(109)&chr(108)&">"
response.end%>
<%end if%>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -