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

📄 photor.asp

📁 一个比较完整的企业erp系统
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!--#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>&nbsp;<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'>大小 &lt;<Option value='size desc'>大小 &gt;<Option value='moddate asc'>日期 &lt;<Option value='moddate desc'>日期 &gt;</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 "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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>&nbsp;</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>&nbsp;</font></td>"	
		End if
	End If
	Response.write "<td><font face=arial size=2>&nbsp;" & SizeString(RS("Size")) & "</font>&nbsp;</td><td><font face=arial size=2>&nbsp;" & RS("ModDate") & "&nbsp;</font></td>"
	Response.Write "<td>&nbsp;<a href='#' title='插入图片' onclick=vbscript:sendmsg('" & t & "')><font face=arial size=1.5>插入</font></a>&nbsp;<a href='#' title='预览图片' onclick=javascript:showimg('" & t & "');><font face=arial size=1.5>预览</font></a>&nbsp;</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>&nbsp;<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 & " &copy;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 + -