<% @ LANGUAGE=VBScript%> <%Response.Buffer = True%> My Guest Book

 

Welcome to my Guest Book

 

<% Response.Write "" Dim objFile Set objFile = CreateObject("Scripting.FileSystemObject") If chkTheme = "checked" then Set ThemePath = objFile.GetFolder(server.mappath(dbFolder) & "\gb_themes") For each tf in ThemePath.files ThemeFile = tf.name If cookieTheme = "" then If ThemeFile = selectedTheme then sel = "selected": Else: sel = "": End If Else If ThemeFile = cookieTheme then sel = "selected": Else: sel = "": End If End If ThemeList = ThemeList & "" Next %>
Select Theme:   

 

<% End if sep = chr(164) Select Case Request.form("submitFlag") Case "post" IP = Request.ServerVariables("REMOTE_ADDR") If chkSpam = "checked" then dbFile = server.mappath(dbFolder & "guestrecord") Set recordSet=objFile.OpenTextFile(dbFile, 1) allRecords = recordSet.ReadAll recordSet.Close If instr(allRecords, IP) <> 0 then Spam = True End If If Spam then Response.Write "" Else Name = Trim(Request.form("fName")) Email = Trim(Request.form("fEmail")) URL = Trim(Request.form("fURL")) IF Len(URL) < 10 then URL = "" Comment = Trim(Request.form("fComment")) If chkHTML = "" then Comment = server.HTMLencode(Comment) Comment = REPLACE(Comment,VbCrlf,"
") 'Comment = InsertSmiley(Comment) If chkOpt1 = "checked" then Custom1 = Request.form("fCustom1") If chkOpt2 = "checked" then Custom2 = Request.form("fCustom2") Call Save_Record(Name, Email, URL, Comment, IP, Custom1, Custom2) Response.Clear Response.Redirect "view.asp" End If Case "theme" ThemeFile = Request.form("D1") Set tFile=objFile.OpenTextFile(ThemePath & "\" & ThemeFile, 1, False) getColors = tFile.ReadAll tFile.Close colorArray = Split(getColors, vbCrLf) colorArray(16) = ThemeFile Response.Cookies("BookThemes") = Join(colorArray, "|") Response.Clear Response.Redirect "default.asp" End Select '*** Function opens record file on the server (creates if not exists). File located in "dbFolder" folder off the root. '*** "dbFolder" location is set in the modify.asp '*** Then appends a line at the end of file. Line contains fields data + IP address '*** of the client, separated by a special character. IP address displayed only at the administration page. '*** x is a 3 digit random number added to a date/time ("Now" function) string to enforce ID uniqueness (see function below). '*** So "Now & x" string will serve as a unique message ID for the Guest Book and messages will be referrenced by it on other pages. Function Save_Record(Name, Email, URL, Comment, IP, Custom1, Custom2) dbFile = server.mappath(dbFolder & "guestrecord") Set recordSet=objFile.OpenTextFile(dbFile, 8, True) x = RandomNumber recordSet.writeline Now & x & sep & Name & sep & Email & sep & URL & sep & Comment & sep & IP & sep & Custom1 & sep & Custom2 recordSet.Close End Function '*** Creates a random 3 digit Number. Function RandomNumber() Randomize RandomNumber = Int((899 * Rnd) + 100) End Function %>
<% If chkOpt1 = "checked" then Response.Write "" Response.Write "" End If If chkOpt2 = "checked" then Response.Write "" Response.Write "" End If %>
 Name:
 Email:
 URL:
 " & fieldName1 & ":" Response.Write "
 " & fieldName2 & ":" Response.Write "
Comment:

    View     Smiley      Reset      Submit