%@ LANGUAGE="VBScript" %>
<%
'Set file I/O constants.
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
'Map the file name to the physical path on the server.
filename = "Videolog.xls"
path = Server.MapPath(".") & "\" & filename
'Get requested operation, if any.
ClientAddress = Request.QueryString("Email")
ClientIP = Request.ServerVariables("remote_addr")
set fs = CreateObject("Scripting.FileSystemObject")
if fs.FileExists(path) then
''Response.Write("File " & filename & " already exists, create aborted.
" & vbCrLf)
'Otherwise create it and write some data to it.
else
''Response.Write("Creating " & path & filename & ".
")
set file = fs.CreateTextFile(path)
file.WriteLine("Client Email" & Chr(9) & "DateTime " & Chr(9) & "IP Address")
file.Close()
end if
sub AppendFile(path)
dim fs, file
''Response.Write("AppendFile:
")
set fs = CreateObject("Scripting.FileSystemObject")
'Open or create the file as needed and append a line to it.
''Response.Write("Appending line to " & filename & ".
")
set file = fs.OpenTextFile(path, ForAppending, true)
file.WriteLine(ClientAddress & Chr(9) & Now() & Chr(9) & ClientIP)
file.Close()
end sub
%>
<% 'Perform the request operation.
call AppendFile(path) %>