<%@ LANGUAGE="VBSCRIPT" %> <% 'if (Session("LoggedIn") <> "student" And Session("LoggedIn") <> "professor" And Session("LoggedIn") <> "sponsor" And Session("LoggedIn") <> "administrator" And Session("LoggedIn") <> "secretary") then ' response.redirect Session("RootPath") & "/login.asp" 'end if %> <% Private Function GetName (FullName) ' Function to strip out the name of a fully qualified file iIndex = InstrRev(FullName,"\") If iIndex <> 0 Then GetName = Mid(FullName,iIndex+1) Else iIndex = InstrRev(FullName,"/") If iIndex <> 0 Then GetName = Mid(FullName,iIndex+1) Else GetName = FullName End If End If End Function %> <% Private Function GetPath (FullName) ' Function to string out the path of a fully qualified file iIndex = InstrRev(FullName,"\") If iIndex <> 0 Then GetPath = Left(FullName,iIndex-1) Else iIndex = InstrRev(FullName,"/") If iIndex <> 0 Then GetPath = Left(FullName,iIndex-1) Else GetPath = FullName End If End If End Function %> <% Private Sub ListDirectory(Dir) ' Sub to list the contents of a directory as HTML Response.Write("

") End Sub %> <% ' Process the request If Request.QueryString("ACT") = "" Then ' Default is to simply list directory Set Dir = Server.CreateObject("ActiveFile.Directory") timeoutvalue=CInt(Session("UploadTimeout")) if(timeoutvalue=0) then timeoutvalue=3600 end if Server.ScriptTimeOut=timeoutvalue Dir.Path = Application("PublicationDirectory") ListDirectory Dir CurDir = Dir.Path Set Dir=Nothing ElseIf UCase(Request.QueryString("ACT")) = "DIR" Then ' Change directories Set Dir = Server.CreateObject("ActiveFile.Directory") timeoutvalue=CInt(Session("UploadTimeout")) if(timeoutvalue=0) then timeoutvalue=3600 end if Server.ScriptTimeOut=timeoutvalue Dir.Path = Request.QueryString("NAME") ListDirectory Dir CurDir = Dir.Path Set Dir=Nothing ElseIf UCase(Request.QueryString("ACT")) = "FILE" Then ' Download a file Set File = Server.CreateObject("ActiveFile.File") timeoutvalue=Session("ManuscriptUploadTimeout")+0 if(timeoutvalue=0) then timeoutvalue=3600 end if Server.ScriptTimeOut=timeoutvalue File.Name = Request.QueryString("NAME") File.Download Set File = Nothing if (Session("LoggedIn") <> "editor") then Set Mailer = Server.CreateObject("SMTPsvg.Mailer") Mailer.FromName = "SIS Auto Mailer" Mailer.FromAddress = Session("SystemAdministratorEmail") strMailHost = Session("LocalMailServer") Mailer.RemoteHost = strMailHost Set cmdTemp = Server.CreateObject("ADODB.Command") Set AdministratorList = Server.CreateObject("ADODB.Recordset") cmdTemp.CommandText = "SELECT * FROM dbo.""Administrators"" " cmdTemp.CommandType = 1 Set cmdTemp.ActiveConnection = SISDB AdministratorList.Open cmdTemp, , 1, 3 count=0 Do While Not AdministratorList.EOF if(count<1) then Mailer.AddRecipient AdministratorList("Lastname"),AdministratorList("Email") else Mailer.AddCC AdministratorList("Lastname"),AdministratorList("Email") end if count=count+1 AdministratorList.MoveNext Loop AdministratorList.Close Mailer.ReturnReceipt = false Mailer.ConfirmRead = false Mailer.Subject = "Publication File Download: " & Session("firstname") & " " & Session("lastname") strBody = "To whom it may concern:" & Chr(13) & Chr(10) & Chr(13) & Chr(10) strBody = strBody & "A publication file, """ & GetName(Request.QueryString("NAME")) strBody = strBody & """ has been downloaded by " & Session("firstname") & " " & Session("lastname") strBody = strBody & "." & Chr(13) & Chr(10) & Chr(13) & Chr(10) strBody = strBody & "Thank you," & Chr(13) & Chr(10) & Chr(13) & Chr(10) strBody = strBody & "SIS Auto mailer (" & Now & ")" Mailer.BodyText = strBody Mailer.SendMail end if ElseIf UCase(Request.QueryString("ACT")) = "POST" Then ' Upload a file to the current directory Set Post = Server.CreateObject("ActiveFile.Post") Set Dir = Server.CreateObject("ActiveFile.Directory") timeoutvalue=CInt(Session("UploadTimeout")) if(timeoutvalue=0) then timeoutvalue=3600 end if Server.ScriptTimeOut=timeoutvalue Dir.CreateTemp Application("CreateTemp") Set Post.Directory = Dir Post.FormInputs("FILE").File.Copy Request.QueryString("CURDIR") & GetName(Post.FormInputs("FILE").Value) Dir.Delete True Dir.Path = Request.QueryString("CURDIR") ListDirectory Dir CurDir=Dir.Path Set Dir=Nothing Set Post=Nothing End If %>