<% option explicit %> <% ' Check if the user is logged in or not varChkPass = Request.Cookies("ChkPass") If varChkPass = "adminaccess" then myFolder= request.querystring("album") If myFolder <> "" then imagetextfilepath = "text\"&myFolder&".txt" myFolderPath = Server.MapPath(myFolder) ' ' ' Set objFSO = CreateObject("Scripting.FileSystemObject") If (objFSO.FolderExists(myFolderPath)) and myFolder <> "text" and myFolder <> "images" Then Set objFolder = objFSO.GetFolder(myFolderPath) Else response.redirect "login.asp" End If '-------------------------------------------------------------------- 'check if the form was submitted or not submitcheck = request.form("submit") If submitcheck <> "" then totalpics = request.form("totalpics") 'response.write "form submitted "& totalpics 'Here is where we write to the text file 'Set variables For i = 1 to totalpics textdescription = textdescription + request.form("text"&i&"") + "##" Next response.write textdescription 'create the string 'Check if the folder exists and create it if necessary Set objFSO = CreateObject("Scripting.FileSystemObject") If NOT objFSO.FolderExists(myFolderPath&"\..\text") Then objFSO.CreateFolder(myFolderPath&"\..\text") objFSO.CreateTextFile(myFolderPath&"\..\"&imagetextfilepath) Else 'Make sure the file exists and create it if necessary If NOT objFSO.FileExists(myFolderPath&"\..\text\"&myFolder&".txt") Then objFSO.CreateTextFile(myFolderPath&"\..\"&imagetextfilepath) End if End If 'write it to the file set f = objFSO.OpenTextFile(myFolderPath&"\..\"&imagetextfilepath, ForWriting, True) f.Write textdescription f.Close set f = nothing set objFSO = nothing 'refresh the page response.redirect "admin.asp?album="& myFolder Else 'response.write "NO form submitted" End if '---------------------------------------------------------------------- %> <%= varHost %> - Photos Administration <% Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(myFolderPath) Set objFolderContents = objFolder.Files If objFSO.FileExists(objFolder&"\..\"&imagetextfilepath) = True Then set f = objFSO.GetFile(objFolder&"\..\"&imagetextfilepath) 'open the textstream set ts = f.OpenAsTextStream(ForReading, -2) varts = ts.ReadAll MyArray = split(varts,"##") CheckText = True Else CheckText = False End if varCounter = 0 i = 0 %>
<%= varAlbumTitle %>  -  <%= varAlbumDate %>
<%= varAlbumDescription %>

<% varCounter = 0 For each objFileItem in objFolderContents varCounter = varCounter + 1 If CheckText = True Then myPicNum = int(varCounter)-1 If myPicNum <= ubound(MyArray) then textValue = MyArray(myPicNum) End if end if myPicNum = myPicNum + 1 if len(myPicNum) < 2 then myPicNum = "0" & myPicNum End if Response.write " " Response.write "" Response.write"" i=i+1 Next %>
"&varCounter&""&textValue&"
border=0
   
<%Else%> No variable passed. We need to display a list of all the folders here <% response.redirect "login.asp" %> <%end if%> <%Else ' The user is not logged in, redirect back to the login page response.redirect "login.asp" end if%>