I need set my asp page that it redirects on login if the login is and admin it goes to main.asp and if the login is "" then it oges to user.asp.
Aslo, I need to get my view or browse.gif to allo me to view any file in any folder. Right now I cna only view my root folder files , if I go one folder up it reade the file path back to the root.
Heelp. my code below.
<%
'Copyright© 2004. NFI (Michel Gilbert). All rights reserved.
'www.nfiweb.com
'last update: 11/20/2004
'**Start Encode**
'-----------------------------FILE UPLOAD---------------------------------------
on error resume next
Response.Buffer = true
Function BuildUpload(RequestBin)
'Get the boundary
PosBeg = 1
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
boundaryPos = InstrB(1,RequestBin,boundary)
'Get all data inside the boundaries
Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--")))
'Members variable of objects are put in a dictionary object
Dim UploadControl
Set UploadControl = CreateObject("Scripting.Dictionary")
'Get an object name
Pos =InstrB(BoundaryPos,RequestBin,getByteString("Cont ent-Disposition"))
Pos = InstrB(Pos,RequestBin,getByteString("name="))
PosBeg = Pos+6
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
Name = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
PosFile =InstrB(BoundaryPos,RequestBin,getByteString("file name="))
PosBound = InstrB(PosEnd,RequestBin,boundary)
'Test if object is of file type
If PosFile<>0 AND (PosFile<PosBound) Then
'Get Filename, content-type and content of file
PosBeg = PosFile + 10
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
FileName = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
'Add filename to dictionary object
UploadControl.Add "FileName", FileName
Pos =InstrB(PosEnd,RequestBin,getByteString("Content-Type:"))
PosBeg = Pos+14
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
'Add content-type to dictionary object
ContentType =getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
UploadControl.Add "ContentType",ContentType
'Get content of object
PosBeg = PosEnd+4
PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
Value = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
Else
'Get content of object
Pos = InstrB(Pos,RequestBin,getByteString(chr(13)))
PosBeg = Pos+4
PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
Value = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
End If
UploadControl.Add "Value" , Value
UploadRequest.Add name, UploadControl
BoundaryPos=InstrB(BoundaryPos+LenB(boundary),Requ estBin,boundary)
Loop
End Function
Function getByteString(StringStr)
For i = 1 to Len(StringStr)
char = Mid(StringStr,i,1)
getByteString = getByteString & chrB(AscB(char))
Next
End Function
Function getString(StringBin)
getString =""
For intCount = 1 to LenB(StringBin)
getString = getString & chr(AscB(MidB(StringBin,intCount,1)))
Next
End Function
If request("Action")="upload" then
Response.Clear
byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUpload(RequestBin)
If UploadRequest.Item("blob").Item("Value") <> "" Then
contentType = UploadRequest.Item("blob").Item("ContentType")
filepathname = UploadRequest.Item("blob").Item("FileName")
filename =Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))
'FolderName = UploadRequest.Item("where").Item("Value")
Path = Mid(Request.ServerVariables("PATH_TRANSLATED"), 1,Len(Request.ServerVariables("PATH_TRANSLATED")) -Len(Request.ServerVariables("PATH_INFO"))) & "\"
if session("ap")="l" then dd= session("lpath")
if session("ap")="r" then dd= session("rpath")
ToFolder = session("root") & dd
value = UploadRequest.Item("blob").Item("Value")
filename = ToFolder & "\" & filename
Set MyFileObject =Server.CreateObject("Scripting.FileSystemObject")
Set objFile = MyFileObject.CreateTextFile(filename)
For i = 1 to LenB(value)
objFile.Write chr(AscB(MidB(value,i,1)))
Next
objFile.Close
Set objFile = Nothing
Set MyFileObject = Nothing
End If
Set UploadRequest = Nothing
Response.Redirect ("main.asp?ap="& session("ap") &"&lpath="& session("lpath") &"&rpath="& session("rpath"))
Response.End
End If
'-----------------------------------------------------------------------------
'--------------------------------------------------------------
if Request("action")="login" then
strtmp=request("login")&":"&request("pass")
Dim FileObject, oInStream, strOutput
Set FileObject = CreateObject("Scripting.FileSystemObject")
strFilename=server.MapPath(".") & "\data\data.csv"
Set oInStream = FileObject.OpenTextFile(strFilename, 1, 0, 0)
do While NOT oInStream.AtEndOfStream
txt=oInStream.ReadLine
if txt=strtmp then
atmp=oInStream.ReadLine
session("root")=atmp
if atmp="admin" then session("root")="\"
Response.Cookies("filemanaglogin")=request("login" )
end if
loop
oInStream.close
try=true
end if
if Request("action")="logout" then
session("aspcomtrial")=0
session("root")=""
Response.Cookies("filemanaglogin")=""
end if
if Request.Cookies("filemanaglogin")="" or session("root")="" then
%>
<title>Core States Project Login</title>
<link href="css/fileview.css" rel="Stylesheet" type="text/css">
</head>
<body topmargin=0 leftmargin=0>
<table width=100% cellspacing=0 cellpadding=0 border=0 align=center>
<tr><td class="topper">
<a href="http://www.core-eng.com/index.html" class="home"> </a>
</td>
</tr>
<tr>
<td class="topperlink">
<a href="http://www.core-eng.com/index.html" class="home">Home</a>
</td></tr>
<link href="css/fileview.css" rel="Stylesheet" type="text/css">
<div align="center">
<center>
<form action='main.asp?action=login' method='post'>
<table border=0 cellspacing=0 cellpadding=0 width=400 align=center>
<tr><td><br><br><br></td></tr>
<tr>
<table border=0 cellspacing=0 cellpadding=0 width=400>
<tr class=titleRow>
<td align=left>
<span class=boldText>Login</span>
</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=0 width=400 valign="top">
<tr align=center class=lightRow>
<td valign="top">
<br>
<span class=Boldtexttitle>Core States Project Login </span>
<br><br>
<table cellspacing=0 cellpadding=5 border=0 class=loginRow>
<tr>
<td align=left> <span class=boldTexttitle>Username</span></td>
</tr>
<tr>
<td align=center><input type='text' name='login' size='25'></td>
</tr>
<tr>
<td align=left> <span class=boldTexttitle>Password</span></td>
</tr>
<tr>
<td align=center><input type='password' name='pass' size='25'></td>
</tr>
<tr>
<td align=right><input type="image" src="images/btn_login.gif" alt="LOGIN" width="50" height="20" border="0" /></td>
</tr>
</table>
<br><br><br>
</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=0 width=400>
<tr class=titleRow>
<td align=center> </td>
</tr>
</table>
</td></tr>
</table>
<%
if try=true then Response.Write "Incorrect username and/or password!"
try=false
if request("c")=3 then Response.Write "Security warning! You are not loged in!"
%></a>
</div>
</form>
<table cellspacing=0 cellpadding=0 border=0 align=center><tr><td class="footer">
<br>
© Copyright 2002-2004
<a target="_blank" href="http://www.core-eng.com" title="Visit the web page for support" class="footer">
CoreStates, Inc. - All rights Reserved</a></div>
</td></tr></table>
<%
Response.End
end if
rpath=request("rpath")
lpath=request("lpath")
if request("ap")="" then Response.Redirect "main.asp?ap=l&rpath="& rpath &"&lpath="& lpath
for f=1 to len(rpath)
if mid(rpath,f,2)=".." then
session("root")=""
Response.Cookies("filemanaglogin")=""
Response.Redirect "main.asp"
end if
next
for f=1 to len(lpath)
if mid(lpath,f,2)=".." then
session("root")=""
Response.Cookies("filemanaglogin")=""
Response.Redirect "main.asp?code=3"
end if
next
'---------------------------save text------------------------
if request("action")="savetext" then
Set FileObject = CreateObject("Scripting.FileSystemObject")
Set oInStream = FileObject.OpenTextFile(session("rfile"), 2, 0, 0)
oInStream.WriteLine request("text")
oInStream.close
Response.Redirect "main.asp?action=show&file="& request("file") &"&from="& request("from") &"&ap="& request("ap") &"&rpath="& request("rpath") &"&lpath="& request("lpath") &""
end if
%>
<script>
function del(){
document.folder.action="main.asp?action=del&ap=<%= request("ap")%>";
document.folder.submit();
}
</script>
<script>
function copy(){
document.folder.action="main.asp?action=copy&ap=<% =request("ap")%>";
document.folder.submit();
}
</script>
<script>
function move(){
document.folder.action="main.asp?action=move&ap=<% =request("ap")%>";
document.folder.submit();
}
</script>
<%
'-----------------------------------------------
'-----------------------------------------------
Response.Flush
'-----------------------------------------------
'-----------------------------------------------
'--------------------------subpath--------------------------
sub subpath(path)
f=len(path)-1
do while not s<>""
if mid(path,f,1)="\" or mid(path,f,1)="/" then s=f
f=f-1
loop
Response.Write mid(path,1,s-1)
end sub
'--------------------------end sub path-------------------
'------------------------------actions---------------------
'--------------------------DELETE FILES AND DIRS--------------------
if request("action")="del" then
Set objtm = Server.CreateObject("Scripting.FileSystemObject")
files=split(request("file"),", ")
dirs=split(request("dir"),", ")
for f = 0 to 500
on error resume next
objtm.DeleteFolder session("root") & dirs(f)
next
for f = 0 to 500
on error resume next
objtm.DeleteFile session("root") & files(f)
next
Set objtm = nothing
end if
'----------------------delete end------------------------------------
'--------------------------COPY FILES AND DIRS--------------------
if request("action")="copy" then
Set objtmc = Server.CreateObject("Scripting.FileSystemObject")
files=split(request("file"),", ")
dirs=split(request("dir"),", ")
if request("ap")="l" then dd=session("root") & request("rpath")
if request("ap")="r" then dd=session("root") & request("lpath")
for f = 0 to 500
on error resume next
objtmc.CopyFolder session("root") & dirs(f),dd&"\"
next
for f = 0 to 500
on error resume next
objtmc.CopyFile session("root") & files(f),dd&"\"
next
Set objtmc = nothing
end if
'----------------------copy end------------------------------------
'-------------------------CREATE FOLDER--------------------
if request("action")="createfolder" then
Set objtmcfolder = Server.CreateObject("Scripting.FileSystemObject")
if request("ap")="l" then dd=session("root") & request("lpath")
if request("ap")="r" then dd=session("root") & request("rpath")
objtmcfolder.CreateFolder dd &"\"& request("folder")
end if
'----------------------copy end------------------------------------
'-------------------------CREATE FILE--------------------
if request("action")="createfile" then
Set objtmcfolder = Server.CreateObject("Scripting.FileSystemObject")
if request("ap")="l" then dd=session("root") & request("lpath")
if request("ap")="r" then dd=session("root") & request("rpath")
objtmcfolder.Createtextfile dd &"\"& request("file")
end if
'----------------------copy end------------------------------------
'--------------------------MOVE FILES AND DIRS--------------------
if request("action")="move" then
Set objtmm = Server.CreateObject("Scripting.FileSystemObject")
files=split(request("file"),", ")
dirs=split(request("dir"),", ")
if request("ap")="l" then dd=session("root") & request("rpath")
if request("ap")="r" then dd=session("root") & request("lpath")
for f = 0 to 500
on error resume next
objtmm.MoveFolder session("root") & dirs(f),dd&"\"
next
for f = 0 to 500
on error resume next
objtmm.MoveFile session("root") & files(f),dd&"\"
next
Set objtmm = nothing
end if
'----------------------copy end------------------------------------
if request("action")="newfolder" then
%>
<title>Core States Project Login</title>
<link href="css/fileview.css" rel="Stylesheet" type="text/css">
</head>
<body topmargin=0 leftmargin=0>
<table width=100% cellspacing=0 cellpadding=0 border=0 align=center>
<tr><td class="topper">
<a href="http://www.core-eng.com/index.html" class="home"> </a>
</td>
</tr>
<tr>
<td class="topperlink">
<a href="http://www.core-eng.com/index.html" class="home">Home</a>
</td></tr>
</table>
<link href="css/fileview.css" rel="Stylesheet" type="text/css">
<table cellspacing=0 cellpadding=2 border=0 width=100%>
<tr class=titleRow>
<td align=left colspan=3>
<span class=boldText>Core States Project Login</span>
</td>
<td align=right colspan=2>
<span class=boldText><%=Date()%></span>
</td>
</tr>
</table>
<%
menu("s")
if request("ap")="r" then dd="Core Engineer" & request("rpath")
if request("ap")="l" then dd="Core Engineer" & request("lpath")
for f=1 to 10
dd=replace(dd,"\\","\")
next
%>
<center>
<form action='main.asp?action=createfolder' method='post'>
Create new folder in:<br><b><%=dd%><br></b>
<input type='text' size='30' name='folder'>
<input type='hidden' name='rpath' value='<%=request("rpath")%>'>
<input type='hidden' name='lpath' value='<%=request("lpath")%>'>
<input type='hidden' name='ap' value='<%=request("ap")%>'><br>
<input type="image" src="images/newdir.gif" valign=bottom value='Create folder' alt="Create New Folder" width="80" height="20" border="0" />
</form>
</center>
<%
end if
if request("action")="newfile" then
%>
<title>Core States Project Login</title>
<link href="css/fileview.css" rel="Stylesheet" type="text/css">
</head>
<body topmargin=0 leftmargin=0>
<table width=100% cellspacing=0 cellpadding=0 border=0 align=center>
<tr><td class="topper">
<a href="http://www.core-eng.com/index.html" class="home"> </a>
</td>
</tr>
<tr>
<td class="topperlink">
<a href="http://www.core-eng.com/index.html" class="home">Home</a>
</td></tr>
</table>
<link href="css/fileview.css" rel="Stylesheet" type="text/css">
<table cellspacing=0 cellpadding=2 border=0 width=100%>
<tr class=titleRow>
<td align=left colspan=3>
<span class=boldText>Core States Project Login</span>
</td>
<td align=right colspan=2>
<span class=boldText><%=Date()%></span>
</td>
</tr>
</table>
<%
menu("s")
if request("ap")="r" then dd="Core Engineer" & request("rpath")
if request("ap")="l" then dd="Core Engineer" & request("lpath")
for f=1 to 10
dd=replace(dd,"\\","\")
next
%>
<center>
<form action='main.asp?action=createfile' method='post' id=form2 name=form2>
Create new file in:<br><b><%=dd%><br></b>
<input type='text' size='30' name='file'>
<input type='hidden' name='rpath' value='<%=request("rpath")%>'>
<input type='hidden' name='lpath' value='<%=request("lpath")%>'>
<input type='hidden' name='ap' value='<%=request("ap")%>'><br>
<input type="image" src="images/newfile.gif" valign=bottom value='Create file' alt="Create New File" width="80" height="20" border="0" />
</form>
</center>
<%
Response.End
end if
'----------------------------------UPLOAD FORM----------------------------
if request("action")="uploadfile" then
%>
<title>Core States Project Login</title>
<link href="css/fileview.css" rel="Stylesheet" type="text/css">
</head>
<body topmargin=0 leftmargin=0>
<table width=100% cellspacing=0 cellpadding=0 border=0 align=center>
<tr><td class="topper">
<a href="http://www.core-eng.com/index.html" class="home"> </a>
</td>
</tr>
<tr>
<td class="topperlink">
<a href="http://www.core-eng.com/index.html" class="home">Home</a>
</td></tr>
</table>
<link href="css/fileview.css" rel="Stylesheet" type="text/css">
<table cellspacing=0 cellpadding=2 border=0 width=100%>
<tr class=titleRow>
<td align=left colspan=3>
<span class=boldText>Core States Project Login</span>
</td>
<td align=right colspan=2>
<span class=boldText><%=Date()%></span>
</td>
</tr>
<table>
<%
menu("s")
if request("ap")="r" then dd="Core Engineer" & request("rpath")
if request("ap")="l" then dd="Core Engineer" & request("lpath")
for f=1 to 10
dd=replace(dd,"\\","\")
next
session("rpath")=request("rpath")
session("lpath")=request("lpath")
session("ap")=request("ap")
rfile=(session("root") & dd &"\" & request("file"))
session("rfile")=rfile
%>
<center>
<form action='main.asp?action=upload' method='post' id=form1 name=form1 ENCTYPE="multipart/form-data">
Upload file to:<br><b><%=dd%></b><br>
<input TYPE="file" NAME="blob" value size='40'>
<br><input type="image" src="images/up.gif" value='Upload file' alt="UPLOAD" width="80" height="20" border="0" />
</form>
</center>
<%
Response.End
end if
'------------------------text editor---------------------
if request("action")="edit" then
%>
<title>Core States Project
</title>
<link href="css/fileview.css" rel="Stylesheet" type="text/css">
</head>
<body topmargin=0 leftmargin=0>
<table width=100% cellspacing=0 cellpadding=0 border=0 align=center>
<tr><td class="topper">
<a href="http://www.core-eng.com/index.html" class="home"> </a>
</td>
</tr>
<tr>
<td class="topperlink">
<a href="http://www.core-eng.com/index.html" class="home">Home</a>
</td></tr>
</table>
<link href="css/fileview.css" rel="Stylesheet" type="text/css">
<table cellspacing=0 cellpadding=2 border=0 width=100%>
<tr class=titleRow>
<td align=left colspan=3>
<span class=boldText>Core States Project Login</span>
</td>
<td align=right colspan=2>
<span class=boldText><%=Date()%></span>
</td>
</tr>
</table>
<%
menu("s")
if request("from")="r" then dd=request("rpath")
if request("from")="l" then dd=request("lpath")
for f=1 to 10
dd=replace(dd,"\\","\")
next
session("rpath")=request("rpath")
session("lpath")=request("lpath")
session("ap")=request("ap")
rfile=(session("root") & dd & "\" & request("file"))
session("rfile")=rfile
dd="Core Engineer" & dd
%>
<center>
<form action='main.asp?action=savetext&file=<%=request(" file")%>&from=<%=request("from")%>&ap=<%=request(" ap")%>&rpath=<%=request("rpath")%>&lpath=<%=reques t("lpath")%>' method='post'>
<div style="font-size:13px;">
<b>Edit file:</b> <%=dd & "\"& request("file")%></div><textarea rows="16" name="text" cols="61"><%
Set FileObject = CreateObject("Scripting.FileSystemObject")
strFilename=rfile
Set oInStream = FileObject.OpenTextFile(strFilename, 1, 0, 0)
do While NOT oInStream.AtEndOfStream
Response.Write oInStream.ReadLine & chr(10)
loop
oInStream.close
%></textarea>
<br>
<input type="image" src="images/reset.gif" value='Reset changes' alt="RESET" width="55" height="20" border="0" />
<input type="image" src="images/save.gif" value='Save file' alt="SAVE" width="55" height="20" border="0" />
</form>
</center>
<%
Response.End
end if
'------------------------display file---------------------
if request("action")="show" then
%>
<title>Core States Project Login</title>
<link href="css/fileview.css" rel="Stylesheet" type="text/css">
</head>
<body topmargin=0 leftmargin=0>
<table width=100% cellspacing=0 cellpadding=0 border=0 align=center>
<tr><td class="topper">
<a href="http://www.core-eng.com/index.html" class="home"> </a>
</td>
</tr>
<tr>
<td class="topperlink">
<a href="http://www.core-eng.com/index.html" class="home">Home</a>
</td></tr>
</table>
<link href="css/fileview.css" rel="Stylesheet" type="text/css">
<table cellspacing=0 cellpadding=2 border=0 width=100%>
<tr class=titleRow>
<td align=left colspan=3>
<span class=boldText>Core States Project Login</span>
</td>
<td align=right colspan=2>
<span class=boldText><%=Date()%></span>
</td>
</tr>
</table>
<%
menu("s")
if request("from")="r" then dd=request("rpath")
if request("from")="l" then dd=request("lpath")
for f=1 to 10
dd=replace(dd,"\\","\")
next
session("rpath")=request("rpath")
session("lpath")=request("lpath")
session("ap")=request("ap")
rfile=(session("root") & dd & "\" & request("file"))
session("rfile")=rfile
pd=dd
dd="Core Engineer" & dd
ext=mid(rfile,len(rfile)-3,4)
npath=replace(Request.ServerVariables("QUERY_STRIN G"),"action=show","action=edit")
if ext=".txt" or ext=".htm" or ext="html" or ext=".shtm" or ext=".shtml" or ext=".log" or ext=".aspx"or ext=".asp" or ext=".php4" or ext=".php" or ext="php3" or ext=".dat" or ext=".csv" or ext=".map" or ext=".inf" or ext=".tab" or ext=".css" then
Response.Write "<br> <b>"& request("file") &" <a class=edit href='main.asp?"& npath &"'><img align=absmiddle border=0 width=50 height=20 src=images/edit.gif alt=Edit file listing></a> </b><table border='0' width='100%' cellspacing='6' cellpadding='0'><tr><td width='100%'>"
Set FileObject = CreateObject("Scripting.FileSystemObject")
strFilename=rfile
Set oInStream = FileObject.OpenTextFile(strFilename, 1, 0, 0)
do While NOT oInStream.AtEndOfStream
txt=oInStream.ReadLine
txt=replace(txt,"<","<")
txt=replace(txt,">",">")
txt=replace(txt," "," ")
Response.Write trim(txt) & "<br>" & chr(10)
loop
oInStream.close
Response.Write "</td></tr></table>"
Response.End
end if
Response.Write "<br> <b>"& request("file") &"</b><table border='0' width='100%' cellspacing='6' cellpadding='0'><tr><td width='100%'>"
Response.Write "Format can not be edited!"
Response.Write "</td></tr></table>"
Response.End
end if
function size(fsize)
ns=round((fsize/1024),1)
if ns<1000 then Response.Write ns & " KB"
if ns>1000 then Response.Write round((ns/1024),1) & " MB"
end function
'-----------------------------actions end------------------
'-----------------------------MENU------------------
Sub menu(my)
if my="n" then
%>
<table cellspacing=0 cellpadding=2 border=0 width=100%>
<tr class=lightRow height=60>
<td width=31%>
<div style="font-size:10pt;"> <img align=absmiddle border=0 width=32 height=27 src="images/folder_open_big.png"> <span class=boldTexttitle>Core Engineer
<rpath=<%=request("rpath")%>&lpath=<%=request("lpa th")%>&ap=l'><%=request("lpath")%>
</span></a></div>
<div style="font-size:8pt;"> </div>
<br>
<div style="font-size:9px; color: 0000FF; font-weight:bold; padding-left: 0px" >
<li>Click any View button to download the corresponding file
<li>Click any Print to print the corresponding file</div>
</td>
<td width=8%>
<span class=boldTexttitle></span> subfolder(s)<br>
<span class=boldTexttitle></span> file(s)
</td>
<td width=8% valign=middle>
Total Size: <span class=boldTexttitle>
</span>
</td>
<td width=35% >
<%Response.Write "<a href='main.asp?action=newfolder&ap="& request("ap") &"&rpath="& request("rpath")&"&lpath=" & request("lpath") & "'>"%><img border="0" src="images/newdir.gif" align="absmiddle" width="80" height="20"></a>
<%Response.Write "<a href='main.asp?action=newfile&ap="& request("ap") &"&rpath="& request("rpath")&"&lpath=" & request("lpath") & "'>"%><img border="0" src="images/newfile.gif" align="absmiddle" width="80" height="20"></a>
<a href='main.asp?action=uploadfile&ap=<%=request("ap ")%>&rpath=<%=request("rpath")%>&lpath=<%=request( "lpath")%>'><img border="0" src="images/up.gif" align="absmiddle" width="80" height="20"></a></b>
<!--MG I commented out move and copy file becaue they won't need this feature at all in using this script
<a href='javascript
:copy();'><img border="0" src="images/copy.gif" align="absmiddle" width="15" height="15"></a>
<a href='javascript
:move();'><img border="0" src="images/move.gif" align="absmiddle" width="15" height="15"></a>
-->
<a href='javascript
:del();'><img border="0" src="images/del.gif" align="absmiddle" width="80" height="20"></a>
<br><input name=Message type=text class=formClass size=45 value="<%=server.HTMLEncode(Message)%>" readonly>
</td>
<%
end if
%>
<%
if my="s" then
%>
<table border="0" width="100%" bgcolor="#92B7F6" cellspacing="0" cellpadding="1">
<tr>
<td width="70%">
<%Response.Write "<a href='main.asp?ap="& request("ap") &"&rpath="& request("rpath")&"&lpath=" & request("lpath") & "'>"%>
<img border="0" src="images/browseback.gif" align="absmiddle" width="150" height="20"></a>
</a></b>   ;
</td>
<%
end if
%>
<td width="100%" valign=bottom>
<a href=""><img align=absmiddle border=0 width=50 height=20 src="images/refresh.gif" alt="Refresh file listing"></a>
<a href='main.asp?ap=<%=request("ap")%>'><img border="0" src="images/root.gif" align="absmiddle" width="55" height="20"></a>
<a href='main.asp?action=logout'><img border="0" src="images/logout.gif" align="absmiddle" width="50" height="20"></a>
</tr>
</table>
<%
end sub
Function ShowImageForType(strName)
Dim strTemp
strTemp = strName
If strTemp <> "dir" Then
strTemp = LCase(Right(strTemp, Len(strTemp) - InStrRev(strTemp, ".", -1, 1)))
End If
Select Case strTemp
Case "asp"
strTemp = "asp"
Case "dir"
strTemp = "dir"
Case "htm","html","shtm"
strTemp = "htm"
Case "gif", "jpg","png"
strTemp = "img"
Case "txt"
strTemp = "txt"
Case "dirup"
strTemp = "fldup"
Case Else
strTemp = "file"
End Select
strTemp = "<IMG SRC=""images/" & strTemp & ".gif"" WIDTH=16 HEIGHT=16 BORDER=0>"
ShowImageForType = strTemp
End Function
%>
<%
'---------------------------------------LEFT-----------------------------------------
sub dirlistl()
dim c
Dim strPath
Dim objFSO
Dim objFolder
Dim objItem
c=1
color="92B7F6"
strPath = session("root") & Request("lpath")
if strPath="" or strPath="\" then
%>
<B>SELECT DRIVE</B>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" bgcolor="#0000FF"><b>Select drive
</b></td>
</tr>
<tr>
<td width="100%" bgcolor="#CECBCE">
<%
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
for f=1 to objFSO.Drives.Count +10
%>
<%
if objFSO.DriveExists (chr(64+f))=true then Response.Write "<a href='main.asp?ap=r&rpath=" & Request("rpath") & "&lpath="& objFSO.GetDriveName (chr(64+f)&":") &"\'>"& objFSO.GetDriveName (chr(64+f)&":") & "</a> "
next
%>
</td>
</tr>
</table>
<%
end if
if strPath<>"" then
on error resume next
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strPath)
%>
<%if request("ap")="l" then Response.Write "<form method=""post"" name=""folder"">"%>
<input type='hidden' name='rpath' value='<%=request("rpath")%>'>
<input type='hidden' name='lpath' value='<%=request("lpath")%>'>
<table border="0" width="100%" cellspacing="0" cellpadding="1"><p>
<a href='main.asp?rpath=<%=request("rpath")%>&lpath=< %=request("lpath")%>&ap=l'>
<TR class=darkRow>
<%if request("ap")="l" then%><TD width=2%></TD><%end if%>
<TD class=boldText width="30%">File Name:</TD>
<TD class=boldText width="10%"><B>File Size:</TD>
<TD class=boldText width="20%">File Type:</TD>
<TD class=boldText width="20%">Date Created:</TD>
<TD class=boldText width="20%">Action:</TD>
</TR></a>
<%
'if request("lpath")<>"" and request("lpath")<>"\" and request("lpath")<>"\\" and request("lpath")<>"\\\" then
if request("lpath")<>"" then
%> <a href='main.asp?rpath=<%=request("rpath")%>&lpath=< %=request("lpath")%>&ap=l'>
<TR class="folderrow">
<%if request("ap")="l" then%><TD > </TD><%end if%>
<TD ><%= ShowImageForType("dirup") %> <A HREF="main.asp?ap=l&rpath=<%=request("rpath")%>&lp ath=<%subpath(request("lpath"))%>\<%objItem.Name%> ">....</A></TD>
<TD> </TD>
<TD> </TD>
<TD> </TD>
<TD> </TD>
</TR></a>
<%
end if
For Each objItem In objFolder.SubFolders
if c=2 then color="010066"
if c=3 then
c=1
color="92B7F6"
end if
If InStr(1, objItem, "_vti", 1) = 0 Then
%>
<a href='main.asp?rpath=<%=request("rpath")%>&lpath=< %=request("lpath")%>&ap=l'>
<TR BGCOLOR="<%=color%>">
<%if request("ap")="l" then%><TD ALIGN="left" ><input type="checkbox" name="dir" value="<%=request("lpath") & "\" & objItem.Name %>"></A></TD><%end if%>
<TD ><%= ShowImageForType("dir") %> <A HREF="main.asp?ap=l&rpath=<%=request("rpath")%>&lp ath=<%=request("lpath") &"\"& objItem.Name %>"><%= objItem.Name %></A></TD>
<TD ><%= size(objItem.Size) %> </TD>
<TD ><%= objItem.Type %></TD>
<TD ><%= objItem.DateCreated %></TD>
<TD >
<a href="<%=virtual & objItem.Name%>" target="_blank"><img align=absmiddle border=0 width=50 height=20 src="images/browse.gif" alt="Browse File"></a>
<a href="#" ><img onClick="window.print()" align=absmiddle border=0 width=50 height=20 src="images/print.gif" alt="Browse File"></a>
<!-- I am Commenting out the rename folder and delete funtion for the clients. I alos renamed the javascript as an external javascript file called mainscript.
js. Make sure this files is included into this script ans the un-comment these tags.
<a href="javascript
:Command('RenameFile', #34;<%=objItem.Name%>#34;);"><img align=absmiddle border=0 width=50 height=20 src="images/rename.gif" alt="Rename File"></a>
<a href="javascript
:Command('DeleteFile', #34;<%=objItem.Name%>#34;);"><img align=absmiddle border=0 width=50 height=20 src="images/delete.gif" alt="Delete File"></a>
-->
</TD>
</TR></a>
<%
End If
c=c+1
Next 'objItem
For Each objItem In objFolder.Files
if c=2 then color="92B7F6"
if c=3 then
c=1
color="010066"
end if
%>
<a href='main.asp?rpath=<%=request("rpath")%>&lpath=< %=request("lpath")%>&ap=l'>
<TR BGCOLOR="<%=color%>">
<%if request("ap")="l" then%><TD ALIGN="left" ><input type="checkbox" name="file" value="<%=request("lpath") & "\" & objItem.Name %>"></TD><%end if%>
<TD ><%= ShowImageForType(objItem.Name) %> <A HREF="main.asp?action=show&from=l&file=<%=objItem. Name %>&ap=<%=request("ap")%>&rpath=<%=request("rpath") %>&lpath=<%=request("lpath")%>"><%= objItem.Name %></A></TD>
<TD ><%= size(objItem.Size) %></TD>
<TD ><%= objItem.Type %></TD>
<TD ><%= objItem.DateCreated %></TD>
<TD >
<a href="<%=virtual & objItem.Name%>?what" target="_blank"><img align=absmiddle border=0 width=50 height=20 src="images/browse.gif" alt="Browse File"></a>
<a href="#" ><img onClick="window.print()" align=absmiddle border=0 width=50 height=20 src="images/print.gif" alt="Browse File"></a>
<!-- I am Commenting out the rename folder and delete funtion for the clients. I alos renamed the javascript as an external javascript file called mainscript.
js. Make sure this files is included into this script ans the un-comment these tags.
<a href="javascript
:Command('RenameFile', #34;<%=objItem.Name%>#34;);"><img align=absmiddle border=0 width=50 height=20 src="images/rename.gif" alt="Rename File"></a>
<a href="javascript
:Command('DeleteFile', #34;<%=objItem.Name%>#34;);"><img align=absmiddle border=0 width=50 height=20 src="images/delete.gif" alt="Delete File"></a>
-->
</TD>
</TR></a>
<%
c=c+1
Next
Set objItem = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
%>
</form>
</TABLE>
<%
end if
end sub
'---------------------------------------RIGHT-----------------------------------------
sub dirlistr()
Dim strPath
Dim objFSO
Dim objFolder
Dim objItem
c=1
color="C9CBC9"
strPath = session("root") & Request("rpath")
if strPath="" or strPath="\" then
%>
<B>SELECT DRIVE</B>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" bgcolor="#0000FF"><b>Select drive
</b></td>
</tr>
<tr>
<td width="100%" bgcolor="#CECBCE">
<%
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
for f=1 to objFSO.Drives.Count +10
%>
<%
if objFSO.DriveExists (chr(64+f))=true then Response.Write "<a href='main.asp?ap=r&lpath=" & Request("lpath") & "&rpath="& objFSO.GetDriveName (chr(64+f)&":") &"\'>"& objFSO.GetDriveName (chr(64+f)&":") & "</a> "
next
%>
</td>
</tr>
</table>
<%
end if
if strPath<>"" and strPath<>"\" then
on error resume next
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strPath)
%>
<!--MG commented out this area , because it allows http file transfer
<%if request("ap")="r" then Response.Write "<form method=""post"" name=""folder"">"%>
<input type='hidden' name='rpath' value='<%=request("rpath")%>'>
<input type='hidden' name='lpath' value='<%=request("lpath")%>'>
<a href='main.asp?rpath=<%=request("rpath")%>&lpath=< %=request("lpath")%>&ap=r'><B><%=request("rpath")% ></a></B>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" width="100%"><p>