<% session("GformFlag")= session("GformFlag") + 1 If session("GformFlag") = 1 Then Rem Get the current number of hits for this page Set FileObject = Server.CreateObject("Scripting.FileSystemObject") OtherCounterFile = Server.MapPath ("/guest") & "\Gform.txt" Set InStream= FileObject.OpenTextFile (OtherCounterFile, 1, False, False) Number = Instream.Readline Instream.close application.lock application("GformCount") = Number Set OutStream= FileObject.CreateTextFile (OtherCounterFile, True, False) application("GformCount") = application("GformCount") + 1 OutStream.WriteLine application("GformCount") OutStream.close application.unlock End If Dim FileObject, OutStream, InStream 'Set up the email notification info here to save speed up form submissition 'Set DafTools = Server.CreateObject("daftools.daftools.1") 'MailServer = "ns.cosentini.com" 'ReturnPath = "nabrams@cosentini.com" 'Subject = "Your Guest Book has been updated" REM Subject = "Admin Guest Book" 'MailTo = "nabrams@cosentini.com" Set objMail = CreateObject("CDONTS.Newmail") objMail.From = "nabrams@barbneal.com" objMail.To = "nabrams@cosentini.com" objMail.Subject = "Your Guest Book has been updated" Action = UCase(Request("Action")) SubmitName = 0 SubmitEmail = 0 Msg1 = "Please enter your name. *" Msg2 = "Please enter your email address. *" Msg3 = "Please enter your comments." ' Do Some form validation If Action = "SUBMIT" Then 'The form has been submitted If Request("name") = "" Then Msg1 = "Please enter your name, this field is required." Else SubmitName = 1 Msg1="" End If If InStr(Request("email"), "@") = 0 Then Msg2 = "Please enter an email address" & _ " in the form username@location *" SubmitEmail = 0 Else SubmitEmail = 1 Msg2="" End If If Request("comments") = "" Then Msg3 = "Please enter your comments." End If Submit = SubmitName + SubmitEmail 'Check file for duplicates If Submit = 2 Then Set FileObject = CreateObject("Scripting.FileSystemObject") GuestFile = Server.MapPath ("/guest") & "\guests.txt" Set InStream= FileObject.OpenTextFile (GuestFile, 1, False, False) While not InStream.AtEndOfStream Instream.SkipLine() If LCase(Request.Form("name"))= LCase(Instream.Readline)Then Msg1 = "Sorry, this name already exists in the guest book." Submit=0 End If If LCase(Request.Form("email"))= LCase(Instream.Readline)Then Msg2 = "Sorry, this address already exists in the guest book." Submit=0 End If Instream.SkipLine() Wend InStream.Close Set Instream=Nothing End If If Submit = 2 Then 'No duplicates found, add the record Name = Request.Form("name") Email = Request.Form("email") If Request("comments") = "" Then Comments="none" Else Comments = Request("comments") End If rem This is needed for sending the the e-mail UserName = Request.Form("name") UserEmail = Request.Form("email") If Request("comments") = "" Then UserComments="none" Else UserComments = Request("comments") End If application.lock Set FileObject = CreateObject("Scripting.FileSystemObject") NewGuestFile = Server.MapPath ("/guest") & "\guests.new" Set OutStream = FileObject.OpenTextFile(NewGuestFile, 2, True) OutStream.WriteLine (Now) OutStream.WriteLine (Name) OutStream.WriteLine (Email) OutStream.WriteLine (Comments) rem Create guests.new and write the First record with the new entry, rem then append all the previous ones Guestfile = server.mappath ("/guest") & "\guests.txt" set Instream= fileobject.opentextfile (Guestfile, 1, false, false) while not Instream.atendofstream Anow = Instream.Readline OutStream.WriteLine (Anow) Name = Instream.Readline OutStream.WriteLine (Name) Email = Instream.Readline OutStream.WriteLine (Email) Comments = Instream.Readline OutStream.WriteLine (Comments) Wend InStream.Close OutStream.Close Set InStream = Nothing rem Now create and write all the entries to guests.txt rem We have to do this until we get a file copy/rename component set Instream= fileobject.opentextfile (NewGuestfile, 1, false, false) set OutStream = FileObject.OpenTextFile(GuestFile, 2, True) while not Instream.atendofstream Anow = Instream.Readline OutStream.WriteLine (Anow) Name = Instream.Readline OutStream.WriteLine (Name) Email = Instream.Readline OutStream.WriteLine (Email) Comments = Instream.Readline OutStream.WriteLine (Comments) Wend InStream.Close OutStream.Close Set InStream = Nothing application.unlock rem 'Send me some mail 'Data = "Your guest book was updated by visitor " & session("visitorcount") & chr(10) & "Name: " & UserName & chr(10) & "Email: " & UserEmail & chr(10) & "Comments: " & UserComments 'Status = DafTools.SendMail(MailServer,ReturnPath,Subject,MailTo,Data) objMail.Body = "Your guest book was updated by visitor " & session("visitorcount") & chr(10) & "Name: " & UserName & chr(10) & "Email: " & UserEmail & chr(10) & "Comments: " & UserComments objMail.Send Set objMail = Nothing rem 'Display the guest book response.redirect ("/guestbook.htm") End If 'Submit End If 'Action %> Sign the guest book of Neal Abrams
<% 'Here's where the guest book display begins. %>

Thank you for taking the time to sign my guest book.

<%= Msg1 %>
"
<%= Msg2 %>
"
<%= Msg3 %>
">
* This field is required.

Back to Top

Home - The .WAV Collection - The Links Page - About Me

View Guest Book - My Software - What's New

Search this Site

Page last updated on November 28, 1997 4:10 PM
Previous session logged in at: <%= session("LastVisitorTime")%>.