<% ' This is used to control whether or not we empty the guestbook at ' the first hit after midnight. We do it just to keep the list ' short. You'll probably want to set this to False Const bDeleteEntries = False ' Allows us to easily clear the guestbook if we notice someone is ' getting rude! All you need to do is pass it ?clearfile=anything ' Possibly something else you might not want. To disable it comment ' out the Request.QueryString line and uncomment the "" one. Dim bForce, maxLen bForce = Request.QueryString("clearfile") 'bForce = "" ' Maximum length for comments maxLen = "1000" Dim strFile ' String variable to store the path / file we write to strFile = Server.MapPath("cypress_log.txt") ' If the script doesn't have anything posted to it we display the form ' otherwise we process the input and append it to the guestbook file. If Request.Form.Count = 0 Then ' Display the entry form. %> Chef Emile's "CypressLog"

Chef Emile's "CypressLog" Book


Hello Cher! I'd like to know what ya t'ink about our piece of the Internet swamp. Please leave your comments in this public guest book so we can share your thoughts with the alligators, crawfish and other critters.

 

Scribble ya thoughts!

 

Your Name:
Your E-mail Address: (optional)
Subject: (optional)

 


The gators don't like tasteless notes, so please show class to the "CypressLog". If not, the gator does like tasteless hard drives!

View our "Cypress Log" Book!

<% Else ' Check for blank input and Check Comments input If Request.Form("input_a") <> "" AND Request.Form("input_d") <> "" AND trim(Request.Form("input_d")) <> "Yo Gator," AND InStr(Request.Form("input_d"), "href=") = 0 AND InStr(Request.Form("input_d"), "url=") = 0 AND InStr(Request.Form("input_d"), "viagra") = 0 AND InStr(Request.Form("input_d"), "casino") = 0 AND InStr(Request.Form("input_d"), "blogspot") = 0 AND InStr(Request.Form("input_d"), "http://") = 0 AND InStr(Request.Form("input_d"), "Subject:") = 0 AND InStr(Request.Form("input_d"), "@") = 0 AND InStr(Request.Form("input_d"), "Content-Type:") = 0 Then ' Log the entry to the guestbook file Dim objFSO 'FileSystemObject Variable Dim objFile 'File Object Variable Dim oldText 'Contents from the file to be added after new entry ' Create an instance of the FileSystemObject Set objFSO = Server.CreateObject("Scripting.FileSystemObject") ' Open the TextFile (FileName, ForAppending, AllowCreation) Set objFile = objFSO.OpenTextFile(strFile, 1) ' Copy old text to string oldText = objFile.Readall objFile.Close ' Create new file, overwrites old content Set objFile = objFSO.CreateTextFile(strFile, True) ' Log the results objFile.Write "

" If Request.Form("input_a") = "" Then objFile.Write "[no name]" Else objFile.Write Server.HTMLEncode(Request.Form("input_a")) End If objFile.Write ", " objFile.Write FormatDateTime(now(), 1) objFile.Write ", " objFile.Write FormatDateTime(now(), 3) objFile.Write ", " objFile.Write Request.ServerVariables("REMOTE_ADDR") objFile.Write ",

" objFile.Write "

" If Request.Form("input_b") = "" Then objFile.Write "[no e-mail]" Else objFile.Write Server.HTMLEncode(Request.Form("input_b")) End If objFile.Write ", " If Request.Form("input_c") = "" Then objFile.Write "[no subject]" Else objFile.Write Server.HTMLEncode(Request.Form("input_c")) End If objFile.Write "

" objFile.Write "

" If Request.Form("input_d") = "" Then objFile.Write "[no comments]" Else objFile.Write Server.HTMLEncode(Left(Request.Form("input_d"),maxLen)) End If objFile.Write "

" objFile.Write "

" objFile.WriteLine "" ' Write all old text back to file objFile.Write(oldText) ' Close the file and dispose of our objects objFile.Close Set objFile = Nothing Set objFSO = Nothing ' Tell people we've written their info %>

Your comments have been written to the guestbook!

Back to the guestbook <% Else ' Error %>

ERROR writing comments to the guestbook!

Please remove any HTML tags.
Back to the guestbook <% End If End If ' We do this to delete the file every day to keep it managable. ' If you were doing this for real you probably wouldn't want to ' do this so we have defined a const named bDeleteEntries at the ' top of the script that you can set to False to prevent this ' section from running. You could also delete this whole ' If Then....End If block if you'd like. Just be sure to leave ' the script delimiter at the bottom! If bDeleteEntries Then Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.GetFile(strFile) If DateDiff("d", objFile.DateLastModified, Date()) <> 0 Or bForce <> "" Then Set objFile = Nothing ' Can't use delete because we need the file to exist for ' the include the next time the script is run! 'objFile.Delete ' Create a file overwriting old one. Set objFile = objFSO.CreateTextFile(strFile, True) ' The include barks if the file's empty! objFile.Write " " objFile.WriteLine "" objFile.Close End If Set objFile = Nothing Set objFSO = Nothing End If %>

Contact us for further details....ChefEmile@CustomCatering.net

to Home Cookin' Page

Chef Emile L. Stieffel, Aurora Catering, Inc. email address: ChefEmile@CustomCatering.net
Copyright © 1995 Aurora Catering, Inc. All rights reserved.
Revised: March 15, 2006.