Articulos PHP
Mayo 18, 2012, 02:10:54 *
Bienvenido(a), Visitante. Por favor, ingresa o regístrate.

Ingresar con nombre de usuario, contraseña y duración de la sesión
Noticias: Canciones Traducidas - Daforos.com - Fondos Gratis - Portatiles - Hosting - - Recursos Gratuitos Webmaster - elhacker dragonjar - sexo gratis - letras de canciones - Trucos Gratis - Juegos Gratis - Sexe gratuit - Juegos De Coche - porno - Start - Page0 - Page1 - Page2 - Page3 - Page4 - Page5 - Page6 - Page7 - Page8 - Page9 - Page10Page11 - Page12 - Page13 - Page14 - Page15 - Page16 - Page17 - Page18 - Page19 - Page20Page21 - Page22 - Page23 - Page24 - Page25 - Page26 - Page27 - Page28 - Page29 -

Páginas: [1]   Ir Abajo
  Imprimir  
Autor Tema: Crear un "Explorador de archivos" del servidor  (Leído 3766 veces)
administrador
Administrator
Hero Member
*****
Desconectado Desconectado

Mensajes: 22040


Ver Perfil
« : Septiembre 17, 2004, 08:33:59 »

Este código permite navegar por el arbol de directorios del servidor.


<%@ Language="VBScript" %>
<%
'----------------------------------------------------------------------------------------------
' BrowseDir.ASP
'
' By Herman Liu
'
' Note: This code is of no use to readers who do not run browser on host machine.  However, it
' may be helpful to others, especially the intranet authors and administrators.
'
' (1) Normal uses: I use this single ASP whenever I am in the browser on host machine and want
' to find and view a particular file.  For a web file such as .htm, .html or .asp, I have the
' option of opening it as text or rendering it in the browser. In addition, if the selected
' file is .asp or .vbs, I can choose to open it as text with line numbers optionally displayed
' for debugging purposes.
'
' (2) Possible side-line uses: An engineer used this code and discovered that they could view
' files of other customers of the same ISP (This somehow got his company into quite a trouble.
' His boss requested me to confirm to him that this code was not for hacking purposes and that
' the security methods of his ISP were at fault).
'
' If your home dir name is not "WWWROOT", change the value of mHomeDirName accordingly.
'----------------------------------------------------------------------------------------------
%>

<%
    Option Explicit

    Response.AddHeader "cache-control", "private"
    Response.AddHeader "pragma", "no-cache"
    Response.ExpiresAbsolute = #January 1, 1980 00:00:01#
    Response.Expires = 0

    Response.Buffer=True
    Response.Clear
    On Error Resume Next

    DIM objFSO, objFolder, objFile, objFileTemp
    DIM mTestDrive, mDrive, mFolder, mFile
    DIM mDriveColl, mSubFolderColl, mFileColl
    DIM mCurrDrive, mCurrDir, mCurrFileFilter
    DIM mCurrDirString
    DIM arrFilePattern()
    DIM mExt
    DIM mToRedirectTo, OfServerDir
    DIM mFilespec
    DIM mFileText
    DIM mServerName, mHomeDirName
    DIM mIndent, mIndentLen
    DIM mForFileOnly
    DIM mOrigFormat
    DIM mRoot
    DIM i, j, k
    DIM S0, S1
    DIM mWebFiles, mDatabaseFiles, mGlobalFiles, mTextFiles, mImageFiles, mAllFiles
    DIM mXWebFiles, mXDatabaseFiles, mXGlobalFiles, mXTextFiles, mXImageFiles, mXAllFiles
    DIM tmp

    mHomeDirName = "WWWROOT"

       '-------------------------------------------------------------------------------
       ' Find out the root dir name.  The following will produce a virtual path  e.g.
       '     "C:\Inetpub\wwwroot\DocFiles\Browsedir.asp",
       ' the first dir after drivename being the root dir name.
    mRoot = Request.ServerVariables("PATH_TRANSLATED")
    i = InStr(1, mRoot, "\")
    IF i > 0 Then
        j = i + 1
        i = InStr(j, mRoot, "\")
        IF i > 0 then
             mRoot = MID(mRoot, j, i-j)                       ' In middle section
        Else
             mRoot = RIGHT(mRoot, LEN(mRoot) - (j-1))        ' In end section
        End If
           ' We will check whether a filespec has the following string, if yes,
           ' then it is assumed that the file is within the root dir of server.
        mRoot = mRoot & "\"
    Else
        mRoot = ""        
    End If
       '-------------------------------------------------------------------------------

       '-------------------------------------------------------------------------------
       ' If to run as a page, then redirect
    mToRedirectTo = Request.QueryString("ToRedirectTo")
    IF mToRedirectTo <> "" Then
          ' Check and take that portion of path pertaining to a server dir for redirect
        If LEN(mRoot) > 0 Then
       i  = inStr(mToRedirectTo, mRoot)
            IF i > 0 Then
                   ' Get rid of drive letter, ":\" and mRoot (e.g. "Inetpub\")
                   ' Below get e.g. "c:\Inetpub\wwwroot\DocFiles\Browsedir.asp",
                 mToRedirectTo = RIGHT(mToRedirectTo, Len(mToRedirectTo) -Len(mRoot)-3)

                   ' Get rid of mHomeDirName
                   ' Below get e.g. "\DocFiles\Browsedir.asp"
                 mToRedirectTo = RIGHT(mToRedirectTo, Len(mToRedirectTo) - LEN(mHomeDirName))

            Response.clear
            Response.redirect mToRedirectTo
            Response.end
            End If
        End If
    END IF
       '-------------------------------------------------------------------------------

       '-------------------------------------------------------------------------------
        'Define file patterns.  Each ext takes up 4-char length.  (html covers shtml).
    mWebFiles = " htm/html/ css/ inc/ asp/  js/ jsp/ csh/ cfm/ xml/shtml"
    mDatabaseFiles = " sql/ dtq"
    mGlobalFiles = " asa"
    mTextFiles = " txt/ bat/ log"
    mImageFiles = " gif/ jpg/ jpe/jpeg/ bmp"                    ' IE displays bmp
    mAllFiles = "*.*"

    mXWebFiles = "(Web) " & mWebFiles
    mXDatabaseFiles = "(Database) " & mDatabaseFiles
    mXGlobalFiles = "(Global) " & mGlobalFiles
    mXTextFiles = "(Text) " & mTextFiles
    mXImageFiles = "(Graphics) " & mImageFiles    
    mXAllFiles = "(All) " & mAllFiles

    REDIM arrFilePattern(5)
    arrFilePattern(0) = mXWebFiles
    arrFilePattern(1) = mXDatabaseFiles
    arrFilePattern(2) = mXGlobalFiles
    arrFilePattern(3) = mXTextFiles
    arrFilePattern(4) = mXImageFiles
    arrFilePattern(5) = mXAllFiles
       '-------------------------------------------------------------------------------


        'Set up the FileSystem objects
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set mDriveColl = objFSO.Drives

       '-------------------------------------
       ' User has just changed drive (POST)?
       '-------------------------------------
    mCurrDrive = Request("cboDriveName")
       '----------------------------------------------------------
       ' If empty, user has clicked a listed directory name (GET)?
       '----------------------------------------------------------
    IF mCurrDrive = "" Then
         mCurrDrive = Request.QueryString("CurrDrive")
            '-------------------------------
            ' Then it must be a fresh start.
            '-------------------------------
         If mCurrDrive = "" Then
             mCurrDrive = objFSO.GetdriveName(Server.MapPath("/"))
         End If
    Else
        If Request("cboDriveName") <> Request("CurrDrive") Then
             mCurrDrive = Request("cboDriveName")  
                ' Change directory to new drive root accordingly
             mCurrDir = mCurrDrive
        End If
    End If

       ' Test drive
    SET mTestDrive = objFSO.GetDrive(mCurrDrive)
    IF NOT mTestDrive.IsReady Then
         Response.write "<BR><BR><B>&nbsp;&nbsp;Drive not ready </B>"
         Response.write "<FORM NAME='Nothing' ACTION='BrowseDir.asp'>"
         Response.write "<INPUT TYPE='SUBMIT' NAME='nothing' VALUE='OK' STYLE='Width=70; Height=22; Font-size:7; font-weight:bold;'>"
         Response.write "</FORM>"
         Response.end
    End If

       ' If mCurrDir is not set earlier (Change effected if changing drive)
    If mCurrDir = "" Then
         '----------------------------------------------------------
         ' User has clicked a listed directory name (GET)?
         '----------------------------------------------------------
         mCurrDir = Request.QueryString("strPath")
        IF mCurrDir = "" Then
          mCurrDir = Request.QueryString("CurrDir")
           If mCurrDir = "" Then
                  If Request.QueryString("ComboChange") <> "" Then
                         ' It could be due to change of cboDriveName or cboFileFilter.
                         ' Let use find out
                       If Request("cboDriveName") <> Request("CurrDrive") Then
                              ' Change current dir to new drive
                        mCurrDir = Request("cboDriveName")  
                              ' Or, alternatively, mCurrDir=objFSO.GetAbsolutePathName(".")
                       ElseIf Request("cboFileFilter") <> mCurrFileFilter Then
                              ' Don't change dir
                            mCurrDir = Server.MapPath(".")
                       Else
                            mCurrDir = Server.MapPath(".")
                       End if                    
              Else
                     ' Use directory currently we are in when we start
                  mCurrDir = Server.MapPath(".")
            End If
         End If
        End If
    End If

       '------------------------------------------------------------------------
       ' See if user has clicked a file name. If yes, we show file content only
       '------------------------------------------------------------------------
    mForFileOnly = Request.QueryString("ForFileOnly")

    mFileSpec = Request("FileSpec")
    IF mFileSpec = "" Then
         mFileSpec = Request.QueryString("FileSpec")
    End If

    mCurrFileFilter = Request("cboFileFilter")
    IF mCurrFileFilter= "" Then
         mCurrFileFilter = Request.QueryString("CurrFileFilter")
         If mCurrFileFilter = "" Then
              mCurrFileFilter = "(All) " & mAllFiles
         End If
    End If

    mOrigFormat = Request("OrigFormat")
%>

<HTML>
<HEAD>
<TITLE>Files in current dir</TITLE>
<META http-equiv="Content-Type"; Content="text/html; Charset=iso-8859-1">
</HEAD>
<BODY BGCOLOR="#FFFFFF">

<%
   '-------------------------------------------------------------------------
   ' If file of ASP/VBS AND for original format, apply the following and exit
   '-------------------------------------------------------------------------
   If mOrigFormat <> "" And LEN(mFileSpec) > 5 Then

         Response.write "<CENTER>"
         Response.write "<FORM NAME='frmOrigFormat' ACTION='BrowseDir.asp?CurrDrive=" & mCurrDrive & "&amp;" &  "CurrDir=" & mCurrDir & "&amp;" & "CurrFileFilter=" & mCurrFileFilter & "'" & " METHOD='Post'>"

         Response.write "<INPUT TYPE='SUBMIT' NAME='Back' VALUE='Back'  STYLE='Width=70; Height=22; Font-size:7; font-weight:bold;'>"
         Response.write "</FORM>"
         Response.write "</CENTER>"
         Response.write "<BR>"

         Response.write "<FONT style='font-family:Verdana, Arial; font-size:8pt; font-weight:bold;' Color='#000080'>" & mFileSpec & "</FONT>"
         Response.write "<HR>"
 
         Response.write "<FONT style='font-family:Verdana, Arial; font-size:8pt; font-weight:normal;' Color='#000000'>"

         Response.Write "<PRE>"
         Set objFile = objFSO.OpenTextFile (mFileSpec, 1, False, 0)
         DO While NOT objFile.AtEndOfStream
               Response.write Server.HTMLEncode(objFile.ReadLine)
               Response.write  vbCRLF
         Loop
         Response.Write "</PRE>"

         Set objFile = Nothing
         Set objFSO = Nothing
         Response.end
   End If

   '----------------------------------------------------------
   ' If file, in various formats, apply the following and exit
   '----------------------------------------------------------

   If mForFileOnly <> "" And LEN(mFileSpec) > 5 Then
         Response.write "<CENTER>"
        Response.write "<FORM NAME='frmDispFile' ACTION='BrowseDir.asp?CurrDrive=" & mCurrDrive & "&amp;" & "CurrDir=" & mCurrDir & "&amp;" & "FileSpec=" & mFileSpec & "&amp;" & "CurrFileFilter=" & mCurrFileFilter & "'" & " METHOD='POST'>"

         Response.write "<INPUT TYPE='SUBMIT' NAME='Back' VALUE='Back'  STYLE='Width=70; Height=22; Font-size:7; font-weight:bold;'>"

            ' If ASP/VBS file, allow additional button
         If Ucase(Right(mFileSpec, 3)) = "ASP" OR UCASE(right(mfilespec,3))="VBS" Then
               Response.write "&nbsp;"
               Response.write "<INPUT TYPE='SUBMIT' NAME='OrigFormat' VALUE='Orig Format' STYLE='Width=110; Height=22; Font-size:7; font-weight:bold;'>"
         End If

         Response.write "</FORM>"
         Response.write "</CENTER>"
         Response.write "<BR>"

         Response.write "<FONT style='font-family:Verdana, Arial; font-size:8pt; font-weight:bold;' Color='#000080'>" & mFileSpec & "</FONT>"
         Response.write "<HR>"

         Response.write "<FONT style='font-family:Verdana, Arial; font-size:8pt; font-weight:normal;' Color='#000000'>"

         Set objFile = objFSO.OpenTextFile (mFileSpec, 1, False, 0)
         IF Ucase(Right(mFileSpec, 3))="HTM" OR Ucase(Right(mFileSpec, 4))="HTML" Then
        mFileText = objFile.ReadAll
       Response.Write mFileText
         ElseIf Ucase(Right(mFileSpec, 3))="GIF" OR Ucase(Right(mFileSpec, 3))="JPG" OR Ucase(Right(mFileSpec, 3))="JPE" OR Ucase(Right(mFileSpec, 4))="JPEG" Then
       Response.Write "<IMG SRC='" & mFileSpec & "'>"
         ElseIf Ucase(Right(mFileSpec, 3))="ASP" Or ucase(right(mfilespec,3))="VBS" Then
           i = 1
        DO While NOT objFile.AtEndOfStream
                  Response.write "<B>" & cstr(i) & "</B>"
                  Response.write "&nbsp;&nbsp;"
                  Response.write Server.HTMLEncode(objFile.ReadLine)
                  Response.write "<BR>"
                  i = i + 1
             Loop
         Else                                              ' .TXT files
             Response.ContentType = "text/plain"
             mFileText = objFile.ReadAll
            Response.Write Replace(mFileText, vbcrlf, "<BR>")
         End If
         Set objFSO = Nothing
         Set objFile = Nothing
         Response.end
   End If

  
En línea
administrador
Administrator
Hero Member
*****
Desconectado Desconectado

Mensajes: 22040


Ver Perfil
« Respuesta #1 : Septiembre 17, 2004, 08:34:15 »

 '---------------------------------------------------------------------------------
   ' If not file, continue.  Preserve the values of current drivename and filefilter
   ' so that upon looping back to page, we would know, by comparing mCurrDrive and
   ' and value of "cboDriveName", mCurrFileFilter and value of "cboFileFilter",
   ' whether it is a drive change or file filter change (or neither).
   '---------------------------------------------------------------------------------
   
   Response.write "<FORM NAME='frmComboChange' ACTION=" & "'" & "BrowseDir.asp?ComboChange=NotEmpty" & "&amp;" & "CurrDrive=" & mCurrDrive & "&amp;" &  "CurrDir=" & mCurrDir & "&amp;" & "CurrFileFilter=" & mCurrFileFilter & "'" & "METHOD='POST'>"
   Response.write "<TABLE WIDTH='100%' BORDER='0'>"
   Response.write "<TR><TD valign='top'>"
   Response.write "<IMG SRC='Drive.gif' BORDER='0'> &nbsp;"
   Response.write "<SELECT NAME='cboDriveName' ONCHANGE='frmComboChange.submit()'>"
       'Write drives in the combo. If there is a selected one, make it SELECTED
   For Each mDrive In mDriveColl
        Response.write ComboString(mDrive, mCurrDrive)
   Next                   
   Response.write "</SELECT>"
   Response.write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
   Response.write "File filter:&nbsp;"
   Response.write "<SELECT NAME='cboFileFilter' ONCHANGE='frmComboChange.submit()'>"
       'Write filter definitions in the combo. If there is a selected one, make it SELECTED
   For i = 0 To UBOUND(arrFilePattern)
         Response.write ComboString(arrFilePattern(i), mCurrFileFilter)
   Next
   Response.write "</SELECT>"
   Response.write "</TD></TR>"
   Response.write "</TABLE>"
   Response.write "</FORM>"
%>

<B>Current dir: &nbsp;<%=mcurrdir%></B>

<!-- Start governing table-->
<TABLE WIDTH="100%" BORDER="1" CELLSPACING="0" CELLPADDING="0">
    <TR><TH Align='center' Valign='bottom' BGColor='#008080' Width='55%'> <FONT style='font-family:Verdana, Arial; font-size:8pt; font-weight:bold;' Color='aqua'> Paths </TH>
    <TH Align='center' Valign='bottom' BGColor='#008080' Width='45%'><FONT style='font-family:Verdana, Arial; font-size:8pt; font-weight:bold;' Color='aqua'> Files </TH></TR>

<TR>
<TD width='55%' valign='top'>

<TABLE width='100%'>
<%
  '===========================================================
  ' Left hand side table to list all subdir under current dir,
  ' using an independent table within the governing table. The
  ' listing would show each dir section of the current dir path,
  ' last section being the current dir.
  '-----------------------------------------------------------

       ' We are to parse the current dir path at various levels as indicated by "\"
     mCurrDirString = mCurrDir

       ' Ensure we have at least one section recognizable by "\"
     If Right(mCurrDirString, 1) <> "\" Then
         mCurrDirString = mCurrDirString & "\"
     End If

       ' Start from top level
     i = InStr(1, mCurrDirString, "\")

     Response.Write "<TR><TD width='100%' valign='top'>"
     IF LEN(mCurrDirString) = 3 then                          ' Top level
          Response.write "<A HREF='BrowseDir.asp?CurrDrive=" & mCurrDrive & "&amp;" & "strPath=" & Mid(mCurrDirString, 1, i) & "&amp;" & "CurrFileFilter=" & mCurrFileFilter & "'>" & "<IMG SRC='FolderOpen.gif' BORDER='0'>" & Left(mCurrDirString, i) & "[/url]"
     Else
          Response.write "<A HREF='BrowseDir.asp?CurrDrive=" & mCurrDrive & "&amp;" & "strPath=" & Mid(mCurrDirString, 1, i) & "&amp;" & "CurrFileFilter=" & mCurrFileFilter & "'>" & "<IMG SRC='Folder.gif' BORDER='0'>" & Left(mCurrDirString, i) & "[/url]"
     End if
     Response.write "</TD></TR>"
     
        ' Sections after top section, test their existence by continuing with the
        ' value of i from earlier. With each change of level, we indent the entry.

     mIndentLen = "&nbsp;&nbsp;"
     mIndent = mIndentLen
     Do While i <> 0
           ' We search "\" starting from one char after previous "\" position
        i = InStr(i + 1, mCurrDirString, "\")
        If i = 0 Then
              Exit Do
         End If

           ' We build HREF reference from first char of entire path up to the current "\"
           ' position, and show the same accordingly (their full paths). (Note, however,
           ' if it is the current dir, then no reference and change to FolderOpen.gif).
         Response.Write "<TR><TD width='100%' valign='top'>"
         If Mid(mCurrDirString, 1, i-1) = mCurrDir Then
         Response.write mIndent & "<IMG SRC='Folderopen.gif' BORDER='0'>" & Mid(mCurrDirString, 1, i)
             Response.write "</TD></TR>"
               ' A separation row
             Response.write "<TR><TD Align='center' Valign='bottom' BGColor='#008080' Width='55%'> <FONT style='font-family:Verdana, Arial; font-size:8pt; font-weight:bold;' Color='aqua'> Subfolders"
         Else
         Response.write mIndent & "<A HREF='BrowseDir.asp?CurrDrive=" & mCurrDrive & "&amp;" & "strPath=" & Mid(mCurrDirString, 1, i-1) & "&amp;" & "CurrFileFilter=" & mCurrFileFilter & "'>" & "<IMG SRC='Folder.gif' BORDER='0'>" & Mid(mCurrDirString, 1, i) & "[/url]"
         End If
         Response.write "</TD></TR>"
     
             ' Increment indent level
         mIndent = mIndent + mIndentLen
     Loop

       ' Entries of subfolders under current dir (Note: After listing paths leading
       ' to current dir, we now list subfolders' names only, not their full paths).
     mIndent = mIndent & "&nbsp;&nbsp;"
     Set objFolder = objFSO.GetFolder(mCurrDir)
     Set mSubFolderColl = objFolder.SubFolders

       ' Put their data in array
     i = mSubFolderColl.Count
     REDIM arrFolders(i-1, 1)
     j = 0
     For Each mFolder in mSubFolderColl
         arrFolders(j,0) = mFolder.Path
         arrFolders(j,1) = mFolder.Name
         j = j + 1
     Next
     
      ' Sort array by folder name
     For i = 0 To UBOUND(arrFolders)-1
         k = i
         s0 = arrFolders(i, 0)
         s1 = arrFolders(i, 1)
         For j = i + 1 To UBound(arrFolders)
             If StrComp(arrFolders(j, 0), s0, vbTextCompare) < 0 Then
                 s0 = arrFolders(j, 0)
                 s1 = arrFolders(j, 1)
                 k = j
             End If
         Next
         arrFolders(k, 0) = arrFolders(i, 0)
         arrFolders(k, 1) = arrFolders(i, 1)
         arrFolders(i, 0) = s0
         arrFolders(i, 1) = s1
     Next
     
     For i = 0 To UBOUND(arrFolders)
         Response.Write "<TR><TD width='100%' valign='top'>"
           '------------------------------------------------------------------
           ' Here we have to note down also mCurrDir to back come to same dir
           '------------------------------------------------------------------
    Response.Write mIndent & "<A HREF='BrowseDir.asp?CurrDrive=" & mCurrDrive & "&amp;" &  "CurrDir=" & mCurrDir & "&amp;" & "strPath=" & arrFolders(i, 0) & "&amp;" & "CurrFileFilter=" & mCurrFileFilter & "'>" & "<IMG SRC='Folder.gif' BORDER='0'>" & arrFolders(i, 1) &  "[/url]"
         Response.write "</TD></TR>"
     Next

%>

<!-- End left hand side table -->
</TABLE>
<!-- End of left side coloumn of governing table-->
</TD>

<%
  '==============================================================
  ' Right hand side table list all entries under the very current
  ' dir using another independent table within the governing table.
  '---------------------------------------------------------
%>

<!-- Start right hand side coloumn of governing table-->
<TD width='45%' valign='top'>
<TABLE width='100%'>

<%
     Set mFileColl = objFolder.Files
     i = mFileColl.Count
     REDIM arrFiles(i-1, 1)
     j = 0
     For Each mFile in mFileColl
         arrFiles(j, 0) = mFile.Name
         arrFiles(j, 1) = mFile.Size
         j = j + 1
     Next
     
      ' Sort array by file name
     For i = 0 To UBOUND(arrFiles)-1
         k = i
         s0 = arrFiles(i, 0)
         s1 = arrFiles(i, 1)
         For j = i + 1 To UBound(arrFiles)
             If StrComp(arrFiles(j, 0), s0, vbTextCompare) < 0 Then
                 s0 = arrFiles(j, 0)
                 s1 = arrFiles(j, 1)
                 k = j
             End If
         Next
         arrFiles(k, 0) = arrFiles(i, 0)
         arrFiles(k, 1) = arrFiles(i, 1)
         arrFiles(i, 0) = s0
         arrFiles(i, 1) = s1
     Next
     
     For i = 0 To UBOUND(arrFiles)
         tmp = ""

         mExt = FindExt(arrFiles(i, 0))
         mExt = Ucase(mExt)
         IF LEN(mExt) > 4 then
             mExt = RIGHT(mExt, 4)
         ElseIf LEN(mExt) < 4 Then
             mExt = SPACE(4 - LEN(mExt)) & mExt
         End If

         IF mCurrFileFilter = mXAllFiles Then
             tmp = "X"
         Else
             If inStr(1, Ucase(mCurrFileFilter), mExt) then
                  tmp = "X"
             end if
         End If

         If tmp <> "" Then
   Response.write "<TR><TD width='65%' align='left' valign='top'>"
        Response.write "<A HREF='BrowseDir.asp?ForFileOnly=NotEmpty" & "&amp;" & "CurrDrive=" & mCurrDrive & "&amp;" & "CurrFileFilter=" & mCurrFileFilter & "&amp;" & "FileSpec=" & mCurrDirString & arrFiles(i,0) & "&amp;" & "FileFilter=" & mCurrFileFilter & "'>" & "<IMG SRC='File.gif' BORDER='0'>" & arrFiles(i,0) & "[/url]"
        Response.write "</TD><TD width='25%' align='right' valign='top'>"
        Response.write cStr(arrFiles(i, 1))
             Response.write "</TD><TD width='10%' align='right' valign='top'>"

             IF Ucase(RIGHT(mExt, 3)) = "ASP" OR Ucase(RIGHT(mExt, 3))="HTM" OR Ucase(mExt)="HTML" Then
                     ' See if the file resides within server boundary
                   tmp = mCurrDirString & arrFiles(i,0)                   
                   IF LEN(mRoot) > 0 AND inStr(1, tmp, mRoot)>0 Then
                        Response.write "<A HREF='BrowseDir.asp?ToRedirectTo=" & tmp & "'>" & "<IMG SRC='Run.gif' BORDER='0'>[/url]"
                   ELSE
                       Response.write "&nbsp;&nbsp;"
                   END IF
             ELSE
                Response.write "&nbsp;&nbsp;"
             END IF
        Response.write "</TD></TR>"
         End If
     Next
%>
<!-- End right hand side table -->
</TABLE>
<!-- End of right side coloumn of governing table-->
</TD>

<!--End governing table-->
</TR>
</TABLE>

</BODY>
</HTML>

<%
    Set objFSO = Nothing
    Set objFolder = Nothing
    Response.end
%>

 

<%
FUNCTION ComboString(forValue, ValueSelected)
     DIM mOptString
     DIM forText
     forText = forValue
     If forValue = ValueSelected then
          mOptString = "<OPTION VALUE='" & forValue & "'" & " SELECTED>" & forText & "</OPTION>"
     Else
          mOptString = "<OPTION VALUE='" & forValue & "'>" & forText & "</OPTION>"
     End if
     ComboString = mOptString
End FUNCTION

 

FUNCTION FindExt(inPath)
    Dim Ext, PathLen, Pos, i
    PathLen = Len(inPath)
    Pos = 0
    Ext = ""
    For i = PathLen To 1 Step -1 
        If Mid(inPath, i, 1) = "." then
             exit for
        End If
    Next
    Pos = i
    IF Pos > 0 then
        Ext = RIGHT(inPath, PathLen-Pos)
    End if
    FindExt = Ext
End Function
%>
En línea
tecnico1
Newbie
*
Desconectado Desconectado

Mensajes: 1


Ver Perfil
« Respuesta #2 : Noviembre 25, 2008, 06:41:25 »

Hola, ya se que este post antiguo. Pero por favor necesito de alguna forma hacer que funcione el código citado en esta página pero con una condición y es que sólo permita la navegación por una carpeta, no por todas las carpetas. El combo de selección de unidades no lo muestro, pero quiero cambiar la carpeta inicial y que no permita ir más alla. He tratado de cambiarlo poniendo la ruta del directorio en la variable "mHomeDirName" pero nada.
Gracias de antemano y un saludo.
En línea
Páginas: [1]   Ir Arriba
  Imprimir  
 
Ir a:  

Mas buscadas: apuntes audio belleza bolsa cancer carpet carrera casas computadora credito cross curso informatica divx dolar drivers e mule economia explorer grafica hardware higiene industria industrial informatica internet libros linux mantenimiento manuales media medicina nutricion online paginas web politica posicionamiento programacion red red alert salud seguro seo software tecnologia trucos windows universidad venta video web windows winrar

UseBB Port by Gaia Modified & Upgraded by Croco Articulos PHP | Impulsado por SMF 1.1.11.
© 2005, Simple Machines LLC. Todos los Derechos Reservados.

Página creada en 0.091 segundos con 19 consultas.