?? photo.asp
字號:
<!--#include file="upload.asp"-->
<%
'*****************************************************************
'* 感謝fileman作者
'* 感謝無組件上傳類作者
'* 感謝HTML編輯器作者
'***********************************
'* 作者:韓非
'* QQ:9437882
'* Email:hanf@myce.net.cn
'* 所有功能及代碼公開,請保留以上文字,謝謝合作!
'* 如果你在使用過程中,有什么問題或有更好的建議及想法,請與我聯系!
'*****************************************************************
GetFolderSize=True
DefaultPageSize=20
DefaultSortBy="Name Asc"
DefaultDisplayType="1"
BeautifyFileNames=True
ShowOnlyLocalDrives=True
UnEditableExtensions="com,exe,dll,ocx,386,drv,bin,jpg,gif,bmp,zip,arj,rar,mdb,xls,mp3,mpg,avi,mov"
'### Find settings
FindRecursive=True
ShowPathsInFind=True
'### Size limits
MaxTransferSize=800*1024
MaxEditSize=128*1024
'### Color scheme
BgColorHeader="000080"
BgColorFolders="DDDDDD"
BgColorFiles="EEEEF8"
'===============================================================================================
'On error resume Next
Server.ScriptTimeout=18000
Response.buffer=true
'**Start Encode**
Version="1.5a"
'========================
'Main
'========================
a=Request("a")
f=Request("f")
Target=Request("target")
Set fso =CreateObject("Scripting.FileSystemObject")
'**********把目錄限制在指定目錄uploadImages**
Session("dir")=Server.mappath("../uploadImages")
Response.write "<title>插入圖片</title>"
dir=StartCapital(Request("dir"))
If dir<>"" Then Session("dir")=Dir
If Right(Session("dir"),1)<>"\" Then Session("dir")=Session("dir") & "\"
If Target<>"" AND Instr(Target,":\")=0 Then Target=Session("dir") & Target
If IsForbidden(Session("dir")) OR IsForbidden(f) OR IsForbidden(target) Then ShowError("Access to this folder has been denied in script configuration.")
Session("LastAction")=Session("ThisAction")
Session("ThisAction")=a
If a="" Then
ShowToolbar Session("Dir")
ListFiles Session("Dir"), ""
CloseList
ElseIf a="upload" Then
Upload Session("Dir")
ElseIf a="del" Then
Del f
ElseIf a="find" Then
ShowToolbar Session("Dir")
ListFiles Session("Dir"), f
CloseList
End If
set fso=nothing
'========================
SUB ListFiles(dir,f)
'========================
On error resume Next
FindString=f
If Session("Sort")="" Then Session("Sort")=DefaultSortBy
If Request("Sort")<>"" Then Session("Sort")=Request("Sort")
If Session("ItemsPerPage")="" Then Session("ItemsPerPage")=DefaultPageSize
If Request("ItemsPerPage")<>"" then Session("ItemsPerPage")=CLng(Request("ItemsPerPage"))
If Session("DisplayType")="" Then Session("DisplayType")=DefaultDisplayType
If Request("DisplayType")<>"" Then Session("DisplayType")=Request("DisplayType")
Response.cookies("wfm")("Sort")=Dir
Response.cookies("wfm")("Dir")=Dir
Response.cookies("wfm").Expires=Now + 30
Response.write "<table><tr bgcolor=" & BgColorHeader & "><td colspan=5>"
'********
Response.Write "<table width='100%'><tr><td><font face=arial size=2 color=FFFFFF> <b>" & "" & "</b></td><td align=right>"
Response.Write "<Select name=sort style='font-family: arial; font-size: 11' onChange='this.form.submit()'><Option selected value=''>-排序-<Option value='name'>名稱<Option value='type, name'>類型<Option value='size asc'>大小 <<Option value='size desc'>大小 ><Option value='moddate asc'>日期 <<Option value='moddate desc'>日期 ></select>"
Response.Write "<Select name=ItemsPerPage style='font-family: arial; font-size: 11' onChange='this.form.submit()'><Option selected value=''>-文件數-<Option>5<Option>10<Option>15<Option>20<Option>25<Option>35<Option>50<Option>100<Option value=100000>All</select>"
Response.Write "<Select name=DisplayType style='font-family: arial; font-size: 11' onChange='this.form.submit()'><Option selected value=''>-顯示方式-<Option value=1>詳細列表<Option value=2>縮略圖</select></td></tr></table>"
Response.Write "</td></tr>"
t=fso.GetparentFoldername(dir)
If len(Dir)>3 AND NOT IsForbidden(t) Then
t=server.urlencode(t)
Response.write "<tr bgcolor=" & BgColorFolders & "><td>"
Response.write " </td>"
Response.write "<td><font face=arial size=2>文件</font></td><td align=center><font face=arial size=2>大小</font></td><td align=center><font face=arial size=2>上傳日期</font></td><td align=center><font face=arial size=2></font></td></tr>"
End If
Page=CInt(Request("page"))
If FindString= "" Then
If Session("LastAction")<>"" OR Session("ListedFolder")<>Session("dir") Then FillRS dir, "", False
Else
If Session("LastAction")<>"find" OR Page=0 Then FillRS dir, FindString, FindRecursive
End If
Set RS=Session("RS")
RS.sort = "IsFolder desc, " & Session("Sort")
RS.PageSize = Session("ItemsPerPage")
TotalPages = RS.PageCount
TotalItems=RS.recordcount
If Page>TotalPages OR Page<1 Then Page=1
If (Page-1)*Session("ItemsPerPage")<TotalItems Then RS.Move (Page-1)*Session("ItemsPerPage")
While NumItems<Session("ItemsPerPage") AND NOT RS.EOF
NumItems=NumItems+1
Info="大小: " & FormatNumber(RS("Size"),0,0,0,-1) & " Bytes" & VbCrLf & "MSDOS name: " & RS("ShortName") & VbCrLf & "創建日期: "& RS("CreDate") & VbCrLf & "訪問日期: "& RS("AccDate")
path=server.urlencode(RS("Path"))
If RS("IsFolder") Then
'-----***********
Else
Response.write "<tr bgcolor=" & BgColorFiles & "><td><input name=f type=checkbox color: #FFFFFF value='" & RS("path") & "'>"
If RS("type")="gif" Then
img="gif.gif"
Else
img="jpg.gif"
End If
Response.write "<img src=img/"&img&" border=0 Alt='" & Info & "'></td>"
If ShowPathsInFind AND FindString<>"" Then t=StartCapital(Replace(RS("Path"),dir,"",1,-1,1)) Else t=StartCapital(RS("Name"))
If Session("DisplayType")="1" Then '詳細列表方式顯示圖片
Response.write "<td><font face=arial size=2><a href='#' title='預覽圖片' onclick=javascript:showimg('" & t & "');>" & t & "</a> </font></td>"
Else '縮略圖方式顯示圖片
Response.write "<td height=80 align=center valign=middle><img id=imglist src=../uploadImages/"&t&"><br><font face=arial size=2><a href='#' title='預覽圖片' onclick=javascript:showimg('" & t & "');>" & t & "</a> </font></td>"
End if
End If
Response.write "<td><font face=arial size=2> " & SizeString(RS("Size")) & "</font> </td><td><font face=arial size=2> " & RS("ModDate") & " </font></td>"
Response.Write "<td> <a href='#' title='插入圖片' onclick=vbscript:sendmsg('" & t & "')><font face=arial size=1.5>插入</font></a> <a href='#' title='預覽圖片' onclick=javascript:showimg('" & t & "');><font face=arial size=1.5>預覽</font></a> </td>"
Response.write "</tr>" & VbCrLf
RS.moveNext
Wend
Response.Write "<tr bgcolor=" & BgColorHeader & "><td><input name=allbox type=checkbox value='Check All' onclick=CheckAll();></td>"
If GetFolderSize then t=" (" & SizeString(Session("TotalFolderSize")) & ")" Else t=""
Response.write "<td colspan=4><table width='100%'><tr><td><font face=arial size=2 color=FFFFFF> <b>"
Response.write Session("fCnt") & " 個文件 (" & SizeString(Session("TotalFileSize")) & ")"
Response.Write "</b></font></td><td align=right width=130><font face=arial size=2 color=FFFFFF><b>"
If TotalItems>Session("ItemsPerPage") Then
If FindString="" then t="" Else t="&a=find&f=" & server.urlencode(FindString)
If page>2 Then Response.write "<a href=photo.asp?page=1" & t & "><img src=img/first.gif border=0 Alt='首頁'></a> "
If page>1 Then Response.write "<a href=photo.asp?page=" & page-1 & t & "><img src=img/prev.gif border=0 Alt='上一頁'></a>"
Response.write " " & page & "/" &TotalPages & "</b> "
If ((page)*Session("ItemsPerPage"))<TotalItems Then Response.write "<a href=photo.asp?page=" & page+1 & t & "><img src=img/Next.gif border=0 Alt='下一頁'></a>"
If ((page+1)*Session("ItemsPerPage"))<TotalItems Then Response.write " <a href=photo.asp?page=" & TotalPages & t & "><img src=img/last.gif border=0 Alt='末頁'></a>"
End If
Response.write "</b></font></td></tr></table></td></tr></table>"
End Sub
'========================
SUB FillRS (dir, Match, DoRecursive)
'========================
Session("ListedFolder")=dir
Session("fCnt")=0
Session("TotalFileSize")=0
Session("dCnt")=0
Session("TotalFolderSize")=0
Set RS = server.createobject("adodb.recordset")
RS.fields.append "Name",200,255
RS.fields.append "Path",200,255
RS.fields.append "ShortName",200,12
RS.fields.append "Type",200,12
RS.fields.append "ModDate",7
RS.fields.append "CreDate",7
RS.fields.append "AccDate",7
RS.fields.append "Size",3
RS.fields.append "IsFolder",11
RS.open
GetItems RS, dir, Match, DoRecursive
Set Session("RS")=RS
End Sub
'========================
SUB GetItems (RS, dir,match, DoRecursive)
'========================
On error resume Next
Set ofolder=fso.getfolder(dir)
Set oFiles=oFolder.files
For each f in oFiles
If Instr(1,f.name,match,1)>0 then
RS.addnew
RS("name")=f.Name
RS("type")=fso.GetExtensionName(f.name)
RS("path")=f.Path
RS("ShortName")=f.ShortName
RS("ModDate")=f.datelastmodified
RS("CreDate")=f.datecreated
RS("AccDate")=f.DateLastAccessed
RS("Size")=f.size
RS("IsFolder")=False
RS.update
Session("fCnt")=Session("fCnt")+1
Session("TotalFileSize")=Session("TotalFileSize")+RS("Size")
End If
Next
Set oFiles=Nothing
Set ofolder=Nothing
End Sub
'========================
SUB CloseList
'========================
'Response.write "</form><center><font size=1 face=Arial><b>- <a href=http://www.redir.as/fileman>FileMan " & version & " ©2001</a> -"
End Sub
'========================
Function IsForbidden(Path)
'========================
If Len(Path)>1 AND RootFolder<>"" AND Instr(1,Path,RootFolder,1)=0 Then
IsForbidden=True
ElseIf Path<>"" AND ForbiddenList<>"" Then
aTmp=Split(ForbiddenList,",")
For i= 0 to Ubound(aTmp)
If Instr(1,Path,Trim(aTmp(i)),1)>0 Then
IsForbidden=True
Exit For
End If
Next
End If
End Function
'========================
Function SizeString(size)
'========================
If NOT Isnumeric(Size) Then
SizeString=""
ElseIf size=0 Then
SizeString="0kB"
ElseIf Size>1024*1024*1024 Then
SizeString=Round(Size/1024/1024/1024,1) & "GB"
ElseIf Size>10*1024*1024 Then
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -