% ' ** Copyright 2000 by John Martin d/b/a www.ANYPORTAL.com ** ' ** All Rights Reserved. ** ' ** ** ' ** This software is freeware and is not in the public domain. ** ' ** You are hereby granted the right to freely distribute this ** ' ** software as long as this copyright notice remains in place. ** ' ** ** ' ** Comments or suggestions? email: andmore@alief.com ** ' ** ** ' ** Date Remarks ** ' ** --------- ----------------------------------------------- ** ' ** 25 MAY 99 original ** ' ** 26 MAY 99 allow the script to run from a subdirectory ** ' ** 27 MAY 99 increase security use of cookie ** ' ** 03 JUN 99 fix UNIX html file record endings ** ' ** 07 JUN 99 fix spaces in file name problem ** ' ** 10 JUL 99 fix subdirectory problem with createimagetag ** ' ** 10 JUL 99 add create document/folder logic ** ' ** 11 JUL 99 fix spaces in file name, again ** ' ** 11 JUL 99 .cfm & .php3 now edit like .asp/.html, etc. ** ' ** 25 JUL 99 add interface to SA-FILEUP to upload files ** ' ** 25 AUG 99 recode authorization routine, allow no password ** ' ** 31 AUG 99 some cosmetic; integrate with email community ** ' ** 01 SEP 99 add link on detail page ** ' ** 05 SEP 99 add missing EndHTML on detail page ** ' ** 24 OCT 00 plug /../ hole ** Option Explicit 'universal variables (these undo the option explicit) Dim action Dim a,b,c,i,item,j Dim arr,tstr 'security Dim gblPassword gblPassword = "romg2413" 'your password here 'configuration Dim gblSiteName,gblSiteCode gblSiteName = Request.ServerVariables("SERVER_NAME") 'Your site name here gblSiteCode = "" Dim gblNow 'server may not be local time gblNow = Now Dim gblFace,gblColor 'needs three quotes gblFace = """Arial, Helvetica, sans-serif""" gblColor = """#000066""" 'global variables Dim gblTitle,gblPageText gblTitle = " * * * TITLE NOT SET * * * " gblPageText = Null 'global constants Dim gblScriptName gblScriptName = Request.ServerVariables("Script_Name") gblScriptName = Mid(gblScriptName,InstrRev(gblScriptName,"/") + 1) Dim gblRoot gblRoot = Replace(Request.ServerVariables("Script_Name"),"/" & gblScriptName,"") Dim gblRed gblRed = """#FF0000""" Dim gblReverse gblReverse = """#E0E0E0""" '----------- 'subprograms '----------- '-- 'StartHTML Sub StartHTML %>
| SIZE=3 FACE=<%=gblFace%>><%=gblSiteName%> |
| > SIZE=4 COLOR="#FFFFFF"> <%=gblTitle%> |
| SIZE=2><%=gblPageText%> |
Sorry." & VBCRLF End If EndHTML End If End Function 'Authorize '-- ' Condensation Function Condensation(s) a = 0 For i = 1 to len(s) a = (ASC(mid(s,i,1)) + a*2) Mod 77411 Next 'i Condensation = Right("00000" & Cstr(a),5) & Right("00000" & Cstr((len(s)*23)+25433),5) End Function 'Condensation(s) '-- ' CreateImageTag Function CreateImageTag(fn,altstr,align,border) Dim f,fso,pn Dim tstr,alignstr,borderstr Dim chars,hw,width,height If border = "" Then borderstr = " BORDER=0" Else borderstr = " BORDER=" & Cstr(border) End If If align = "" Then alignstr = "" Else alignstr = " ALIGN=""" Select Case UCase(left(align,1)) Case "L" tstr = "LEFT" Case "R" tstr = "RIGHT" Case "C" tstr = "CENTER" Case Else End Select alignstr = " ALIGN=""" & tstr & """" End If Set fso = CreateObject("Scripting.FileSystemObject") pn = Server.MapPath(fn) tstr = "" Set f = fso.OpenTextFile(pn) Select Case UCase(Right(fn,4)) Case ".GIF",".JPG" If NOT f.AtEndOfStream Then If UCase(Right(fn,4)) = ".GIF" Then 'always works chars = f.read(10) width = asc(mid(chars,8,1))*256 + asc(mid(chars,7,1)) height = asc(mid(chars,10,1))*256 + asc(mid(chars,9,1)) hw = " WIDTH=" & width & " HEIGHT=" & height Else 'usually works chars = f.read(200) height = asc(mid(chars,164,1))*256 + asc(mid(chars,165,1)) width = asc(mid(chars,166,1))*256 + asc(mid(chars,167,1)) If (height > 600) OR (height < 3) OR (WIDTH < 3) OR (WIDTH > 600) Then 'could be wrong height, width... forget 'em Else hw = " WIDTH=" & width & " HEIGHT=" & height End If End If End If tstr = "" & VBCRLF response.write "AnyPortal " & gblTitle & " requires Microsoft NT/Internet Information Server (IIS) 4.0 or greater." & VBCRLF response.write "
" & pathname & "
" & VBCRLF
response.write "" & webbase & fn & "
" & VBCRLF
If fso.FileExists(pathname) Then
' fetch NT's file information
Set f = fso.GetFile(pathname)
fsize = f.size
fdatecreated = f.datecreated
fdatelastmodified = f.datelastmodified
response.write "
" & VBCRLF response.write " file size: " & FormatNumber(fsize,0) & " characters" & VBCRLF response.write " file created: " & FormatDateTime(fdatecreated,1) & " " & FormatDateTime(fdatecreated,3) & VBCRLF response.write "last modified: " & FormatDateTime(fdatelastmodified,1) & " " & FormatDateTime(fdatelastmodified,3) & VBCRLF response.write "" & VBCRLF Set f = Nothing End If response.write " <% EndHTML End Sub 'DetailPage '-- ' DisplayCode Sub DisplayCode Dim fn,fso,f Dim code,tstr Dim a,arr,i fn = Request.QueryString("c") response.write "
| " & VBCRLF response.write " " & fn & " |
Cannot access " & fn & "" & VBCRLF End If response.write "
| ><%=chr(199)%> | SIZE=1><%=UCASE(fso.GetParentfolderName(fsDir) & "\")%> | ||
SIZE=4>Additional Folders |
|||
| COLOR=<%=gblRed%> SIZE=1>FOLDER NAME | |||
SIZE=4><%=fsDir%> |
|||
| COLOR=<%=gblRed%> SIZE=1>DOCUMENT NAME | COLOR=<%=gblRed%> SIZE=1>LAST UPDATE | COLOR=<%=gblRed%> SIZE=1>FILE SIZE | |
| VALIGN="" TOP""> | >
Your browser: Upload also requires that the SA-FileUp object is registered on your web server.
|
<% EndHTML End Sub 'UploadPage '-- ' URLspace Function URLSpace(s) URLSpace = replace(replace(s,"+","%2B")," ","+") End Function 'URLSpace '---- 'MAIN '---- Dim f,fso,filelist,fn,upl Dim TextObject,fhandle,lsplit Dim fsDir,baseDir,webbase Dim fsRoot,webRoot Dim pathname Dim parent Dim toplevel gblTitle = "Site Manager" 'get password If NOT Authorize Then 'function will output HTML for password Else 'initialization Set fso = CreateObject("Scripting.FileSystemObject") 'dynamically find out where the documents and web pages are located fsDir = replace(LCase(Request.QueryString("d")),"/../","/") If fsDir = "" Then fsDir = Request.Form("fsDir") fsRoot = LCase(Replace(Server.MapPath(gblScriptName),"\" & gblScriptName,"") & "\") If Instr(fsdir,fsroot) <> 1 Then fsDir = fsRoot If Lcase(fsDir) = Lcase(fsRoot) Then toplevel = TRUE basedir = Replace(Mid(fsDir,len(fsRoot),250),"\","/") webRoot = "http://" & Request.ServerVariables("SERVER_NAME") & Replace(Request.ServerVariables("SCRIPT_NAME"),"/" & gblScriptName,"") webbase = replace(webroot & basedir," ","%20") 'process a GET/POST request If Request.QueryString("u") = "D" Then Action = "UPLOAD" Else Action = Request.Form("POSTACTION") pathname = Request.Form("PATHNAME") End If Select Case UCase(Action) Case "UPLOAD" Set upl = Server.CreateObject("SoftArtisans.FileUp") tstr = Mid(upl.UserFilename, InstrRev(upl.UserFilename, "\") + 1) If tstr = "" Then Else upl.SaveAs fsdir & tstr End If Case "SAVE" Select Case UCase(Right(pathname,4)) Case ".TXT",".ASA",".ASP",".HTM","HTML",".CFM","PHP3" If Instr(pathname,fsroot) = 1 Then Set f = fso.CreateTextFile(pathname) f.write Request.Form("FILEDATA") f.close End If End Select Case "DELETE" 'either document or folder If Request.Form("OK") = "on" Then parent = Request.Form("Parent") If Instr(pathname,fsroot) = 1 Then fso.DeleteFolder Left(pathname,Len(pathname)-1),TRUE response.redirect gblScriptName & "?d=" & URLSpace(parent) End If End If If Request.Form("DELETEOK") = "on" Then If Instr(pathname,fsroot) = 1 Then If fso.FileExists(Request.Form("PathName")) Then Set f = fso.GetFile(Request.Form("PathName")) f.delete End If End If End If End Select If Action <> "" Then tstr = gblScriptName & "?d=" If NOT toplevel Then tstr = tstr & URLSpace(fsDir) response.redirect tstr End If 'check for mode... navigate, code display, upload, or detail? fn = LCase(Request.QueryString("f")) If fn = "" Then If Request.QueryString("u") = "Y" Then gblTitle = gblTitle & " (Upload Page)" gblPageText = "Use this page to upload a single document to this web site." UploadPage Else If Request.QueryString("c") = "" Then gblPageText = "Use this page to add, delete or revise documents on this web site." StartHTML Navigate EndHTML Else DisplayCode End If End If Else gblTitle = gblTitle & " (Detail Page)" gblPageText = "Use this page to view, modify or delete a single document on this web site." DetailPage End If End If %>