<%@ LANGUAGE="VBSCRIPT" %> <% Response.Expires = 1 %> <% Response.Buffer = True %> <% '=Session.SessionID %> <% Session.Timeout = 1 %> Guest Book <% Dim sDefault, bSave, sname ' The path to your text file ' Make sure to start with an empty file 'Const sPath = "c:\inetpub\wwwroot\cheryl\guests\guests.txt" Const sPath = "d:\home\ntr9f26\database\guests.txt" bSave=false sDefault="Please enter a message" sDefaultName = "Your Name" function UpdateGuestBook() On error resume next WriteToLogFile = False Set fs= Server.CreateObject("Scripting.FileSystemObject") Set objLogFile = fs.OpenTextFile(sPath, 8, False) ' Modify these lines to change the output format objLogFile.WriteLine("
" & request.form("name") & " says,
") objLogFile.WriteLine(request.form("message") & chr(13) & chr(10) & "
") objLogFile.WriteLine("Sent on " & FormatDateTime(now,2) & " at " & FormatDateTime(now,4) & "") objLogFile.Close() if (Err.Number=0) then writeToLogFile=true end function if (request.form("message")<>"") then if (request.form("message")<>sDefault) and (request.form("name")<>sDefaultName) then bSave = UpdateGuestBook() else sDefault = request.form("message") sDefaultName = request.form("name") response.write("You did not enter your name or a message") end if end if %>

Please sign my guest book! <% if not bSave then %>



From
<% else response.write("

Your message has been saved below!") end if %>

Messages from our Visitors:

<%
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objLogFile = objFSO.OpenTextFile(sPath)
  response.write(objLogFile.readAll)
  objLogFIle.close()
%>