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

📄 default.asp

📁 视频源代码 视频源代码
💻 ASP
📖 第 1 页 / 共 3 页
字号:
  filename = Filter_Name(Request("filename"))
  If not filename="" then
    newfilepath=path & filename
    If fso.FileExists(newfilepath)=false then
      Set f = fso.CreateTextFile(newfilepath)
      f.WriteLine Request("content")
      f.close 
      Set f = nothing
      Set f = fso.GetFile(newfilepath)
      f.attributes = CCur(Request("readonly"))+CCur(Request("write"))+CCur(Request("system"))+CCur(Request("hidden"))
      Set f = nothing
    End If
    If Err then
      error="新建出错可能该指定文件操作权限受到限制!"
    End If
  Else
    error="新建文件名含有非法字符!"
  End If
End Sub

Sub delfile()
  ON ERROR RESUME NEXT
  filename = Filter_Name(Request("filename"))
  If not filename="" then
    delfilepath=path & filename
    If fso.FileExists(delfilepath)=true then
      fso.DeleteFile delfilepath
    End If
    If Err then
      error="删除出错可能该指定文件操作权限受到限制!"
    End If
  Else
    error="删除文件名含有非法字符!"
  End If
End Sub

Sub atfile()
  ON ERROR RESUME NEXT
  filename = Filter_Name(Request("filename"))
  If not filename="" then
    filepath=path & filename
    If fso.FileExists(filepath)=true then
      Set f = fso.GetFile(filepath)
      f.attributes = CCur(Request("readonly"))+CCur(Request("write"))+CCur(Request("system"))+CCur(Request("hidden"))
      Set f = nothing
    End If
    If Err then
      error="属性修改出错可能该指定文件操作权限受到限制!"
    End If
  Else
    error="属性修改文件名含有非法字符!"
  End If
End Sub

Sub renfile()
  ON ERROR RESUME NEXT
  oldfilename = Filter_Name(Request("oldfilename"))
  newfilename = Filter_Name(Request("filename"))
  If oldfilename<>"" and newfilename<>"" then
    oldfilepath=path & oldfilename
    newfilepath=path & newfilename
    If fso.FileExists(oldfilepath)=true then
      fso.MoveFile oldfilepath,newfilepath
    End If
    If Err then
      error="重命名出错可能该指定文件操作权限受到限制!"
    End If
  Else
    error="重命名文件名含有非法字符!"
  End If
End Sub

Sub copyfile()
  ON ERROR RESUME NEXT
  oldfilename = Filter_Name(Request("oldfilename"))
  newfilename = Filter_Name(Request("filename"))
  If oldfilename<>"" and newfilename<>"" then
    oldfilepath=path & oldfilename
    newfilepath=path & newfilename
    If fso.FileExists(oldfilepath)=true then
      fso.CopyFile oldfilepath,newfilepath
    End If
    If Err then
      error="复制出错可能该指定文件操作权限受到限制!"
    End If
  Else
    error="复制文件名含有非法字符!"
  End If
End Sub

Sub movefileto()
  ON ERROR RESUME NEXT
  filename = Filter_Name(Request("filename"))
  movepath = Filter_Path(Request("movepath"))
  If filename<>"" and movepath<>"" then
    oldfilepath=path & filename
    newfilepath=movepath & filename
    If fso.FileExists(oldfilepath)=true and fso.FileExists(newfilepath)=flase then
      fso.MoveFile oldfilepath,newfilepath
    Else
      error="文件以存在!"
    End If
    If Err then
      error="移动出错可能该指定文件操作权限受到限制!"
    End If
  Else
    error="移动文件名含有非法字符!"
  End If
End Sub

Sub copyfileto()
  ON ERROR RESUME NEXT
  filename = Filter_Name(Request("filename"))
  copypath = Filter_Path(Request("copypath"))
  If filename<>"" and copypath<>"" then
    oldfilepath=path & filename
    newfilepath=copypath & filename
    If fso.FileExists(oldfilepath)=true and fso.FileExists(newfilepath)=flase then
      fso.CopyFile oldfilepath,newfilepath
    Else
      error="文件以存在!"
    End If
    If Err then
      error="复制出错可能该指定文件操作权限受到限制!"
    End If
  Else
    error="复制文件名含有非法字符!"
  End If
End Sub

'其他

Sub access()
  ON ERROR RESUME NEXT
  accessfilepath=path&Request("filename")
  If fso.FileExists(accessfilepath)=true then
    Set Engine = CreateObject("JRO.JetEngine")
    Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & accessfilepath ,"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path & "temp.mdb"
    Set Engine = nothing
  End If
  If fso.FileExists(accessfilepath)=true then
    fso.DeleteFile accessfilepath
  End If
  fso.CopyFile path&"temp.mdb",accessfilepath
  If fso.FileExists(path&"temp.mdb")=true then
    fso.DeleteFile path&"temp.mdb"
  End If
  If Err then
    error="压缩出错可能你的服务器不支持某些组件!"
  End If
End Sub


'系统驱动器

Sub GetDrive()
  On Error Resume Next
  DriveType=Ccur(Request("Drive"))
  For Each thing in fso.Drives
Response.write vbcrlf&"          <td width=""20""></td><a href=""default.asp?path="&thing.DriveLetter&":\"&OtherType&""">"
Response.write "<th width=""40"" style=""cursor:hand"" onmouseover=""this.style.background='DADADA';"" onmouseout=""this.style.background='EAEAEA';"" title="""
    If thing.DriveType=2 and DriveType=1 then
Response.write "共享名 :"&thing.ShareName&"&#10;"
Response.write "序列号 :"&thing.SerialNumber&"&#10;"
Response.write "卷名  :"&thing.VolumeName&"&#10;"
Response.write "总容量 :"&formatnumber(thing.TotalSize/1048576,2,-1)&"MB&#10;"
Response.write "使用空间:"&formatnumber((thing.TotalSize-thing.FreeSpace)/1048576,2,-1)&"MB&#10;"
Response.write "可用空间:"&formatnumber(thing.FreeSpace/1048576,2,-1)&"MB&#10;"
Response.write "系统类型:"&thing.FileSystem&"&#10;"
Response.write "是否使用:"&thing.IsReady&"&#10;"
Response.write "驱动路径:"&thing.Path&"&#10;"
Response.write "根文件夹:"&thing.RootFolder
    End If
Response.write """><img border=""0"" src=""img/"
    Select case thing.DriveType
      case 1:Response.write "softdisk"
      case 2:Response.write "harddisk"
      case 3:Response.write "webdisk"
      case 4:Response.write "cd-rom"
      case 5:Response.write "mo"
    End Select
Response.write ".gif"" width=""13"" height=""13""> "&thing.DriveLetter&":</th></a>"
  NEXT
End Sub

'目录

Sub GetFolder()
  On Error Resume Next
  FolderType=Ccur(Request("Folder"))
  If fso.FolderExists(path)then
    Set theFolder=fso.GetFolder(path)
    Set theSubFolders=theFolder.SubFolders
Response.write"    <table cellpadding=""1"" cellspacing=""2"" width=""100%"" valign=""middle"">"&vbcrlf
Response.write"      <tr style=""color:FF8000;cursor:hand"" title="""&path&"""><a href=""default.asp?path="&Replace(path,fso.GetBaseFilter_Name(path)&"\","")&OtherType&"""><td colspan=""3""><img border=""0"" src=""img/opendir.gif"" width=""13"" height=""13""> <b>"&fso.GetBaseFilter_Name(path)&"</b></td></a></tr>"&vbcrlf
Response.write"      <form method=""POST"" action=""default.asp?path="&path&OtherType&"&op=mddir"" autocomplete=""off"" name=""newdir"" onSubmit=""return mddir(newdir.dirname.value);"">"&vbcrlf
Response.write"      <tr><td></td><td><img border=""0"" src=""img/dir.gif"" width=""12"" height=""12""></td><td><input class=""text"" type=""text"" name=""dirname"" size=""8""><input class=""button"" type=""submit"" value=""新建目录"" style=""width:38pt""></td></tr>"&vbcrlf
Response.write"      </form>"&vbcrlf
Response.write"      <tr><td width=""2%""></td><td width=""2%""></td><td width=""90%""></td></tr>"&vbcrlf
Response.write"      <form name=""dirtree"">"&vbcrlf
    For Each x In theSubFolders
      a=a+1
Response.write"      <tr onmouseover=""this.style.background='DADADA';"" onmouseout=""this.style.background='F5F5F5';""><td><input id=""box"" type=""checkbox"" name=""box"&a&""" value="""&path&x.Name&""" disabled></td><td><img border=""0"" src=""img/dir.gif"" width=""12"" height=""12""></td><td style=""cursor:hand"" title="""
      If FolderType=1 then
Response.write"属性:"
        Select case x.Attributes
          case 16:Response.write"No"
          case 17:Response.write"只读"
          case 18:Response.write"隐含"
          case 19:Response.write"只读/隐含"
          case 20:Response.write"系统"
          case 21:Response.write"只读/系统"
          case 22:Response.write"隐含/系统"
          case 23:Response.write"只读/隐含/系统"
          case 48:Response.write"存档"
          case 49:Response.write"只读/存档"
          case 50:Response.write"隐含/存档"
          case 51:Response.write"只读/隐含/存档"
          case 52:Response.write"系统/存档"
          case 53:Response.write"只读/系统/存档"
          case 54:Response.write"隐含/系统/存档"
          case 55:Response.write"只读/隐含/存档/系统"
        End Select
Response.write"("&x.Attributes&")&#10;"
Response.write"大小:"
        If x.Size>1073741824 then
Response.write formatnumber(x.Size/1073741824,2,-1)&" GB"
        Elseif x.Size>1048576 then
Response.write formatnumber(x.Size/1048576,2,-1)&" MB"
        Elseif x.Size>1024 then
Response.write formatnumber(x.Size/1024,2,-1)&" KB"
        Else
Response.write formatnumber(x.Size,0,-1)&" B"
        End If
Response.write"&#10;修改:"&x.DateLastModified&"&#10;&#10;"
        Size=Size+x.Size
      End If
Response.write"  单击菜单&#10;  双击进入"" onclick=""dirmenu('"&x.Name&"',"&x.Attributes&",'dir"&a&"')"" ondblclick=""dirto('"&x.Name&"');"" id=""dir"&a&""" name=""dir"&a&"""><b>"&x.Name&"</b></td></tr>"&vbcrlf
    Next
Response.write"      <tr><td colspan=""3"">共用 <b style=""color:blue"">"&a&"</b> 目录"
    If FolderType=1 then
Response.write" <b style=""color:blue"">"
      If Size>1073741824 then
Response.write formatnumber(Size/1073741824,2,-1)&"<font color=FF0000>GB"
      Elseif Size>1048576 then
Response.write formatnumber(Size/1048576,2,-1)&"<font color=FF00FF>MB"
      Elseif Size>1024 then
Response.write formatnumber(Size/1024,2,-1)&"<font color=0000FF>KB"
      Else
Response.write formatnumber(Size,0,-1)&"<font color=FF9900>B"
      End If
    End If
Response.write"</font></b></td></tr>"&vbcrlf
Response.write"      <tr><td colspan=""3""><label for=""dirall"">全选<input id=""dirall"" type=""checkbox"" name=""chkall"" value=""on"" onclick=""checkall(this.form)"" disabled></label>"
Response.write"      <input type=""hidden"" name=""path"" value="""&path&"""><input class=""button"" type=""button"" name=""del"" value=""删"" disabled><input class=""button"" type=""button"" name=""paste"" value=""移"" disabled><input class=""button"" type=""button"" name=""copy"" value=""复"" disabled>"
Response.write"      </td></tr>"&vbcrlf
Response.write"      </form>"&vbcrlf
Response.write"    </table>"
  End If
End Sub

'文件

Sub GetFile()
  On Error Resume Next
  If fso.FolderExists(path)then
    Set theFolder=fso.GetFolder(path)
    Set theFiles=theFolder.Files
Response.write"    <table cellpadding=""2"" cellspacing=""1"" width=""100%"" valign=""middle"">"&vbcrlf
Response.write"      <tr align=""center"" bgcolor=""EFEFEF""><td width=""25%"" colspan=""3"">名称</td><td nowrap>大小</td><td width=""20%"">类型</td><td width=""2%"">属</td><td width=""20%"">修改时间</td></tr>"&vbcrlf
Response.write"      <tr bgcolor=""EFEFEF"">"&vbcrlf
Response.write"      <form name=""newfileform"" onSubmit=""return newfile(newfileform.filename.value);"">"&vbcrlf
Response.write"      <td width=""2%""></td><td width=""2%""><img border=""0"" src=""img/txt.gif"" width=""12"" height=""12""></td><td id=""newfile"" name=""newfile""><input class=""text"" type=""text"" name=""filename"" size=""18""></td><td><input class=""button"" type=""submit"" value=""新建文件"" style=""width:40pt""></td>"&vbcrlf
Response.write"      </form>"&vbcrlf
Response.write"      <form method=""post"" action=""upfile.asp"" enctype=""multipart/form-data"" name=""upfileform"" target=""table"">"&vbcrlf
Response.write"      <td colspan=""3""><img border=""0"" src=""img/file.gif"" width=""12"" height=""12""><input type=""hidden"" name=""path"" value="""&path&"""><input class=""text"" type=""file"" name=""filename"" size=""18""><input class=""button"" type=""submit"" name=""Add"" value=""上传文件"" style=""width:40pt""></td>"&vbcrlf
Response.write"      </form>"&vbcrlf
Response.write"      </tr>"&vbcrlf
Response.write"      <tr><td width=""2%""></td><td width=""2%""></td><td width=""25%""></td><td width=""2%""></td><td width=""25%""></td><td width=""2%""></td><td width=""25%""></td></tr>"&vbcrlf
Response.write"      <form name=""filetree"">"&vbcrlf
    For Each x In theFiles
      a=a+1
Response.write"      <tr bgcolor=""EFEFEF"" onmouseover=""this.style.background='F5F5F5';"" onmouseout=""this.style.background='EFEFEF';""><td nowrap>"
Response.write"<input id=""box"" type=""checkbox"" name=""box"&a&""" value="""&path&x.Name&""" disabled>"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -