<% '/----------------------------------------------\ '>********** Please choose you colors:**********< '\----------------------------------------------/ HeadingCellBgColor="#000099" HeadingCellTextColor="#ffffff" CellBgColor="#f0f0f0" CellTextColor="#000000" %> My guestbook <% '/----------------------------------------------\ '>********* Data selected or requested *********< '\----------------------------------------------/ Flag = Request.form("Flag") If Flag = 1 then Name = Request.form("Name") Email = Request.form("Email") Url = Request.form("Url") Comment = Request.form("Comment") Comment = server.HTMLencode(Comment) 'Do not allow HTML Comment = Replace(Comment,VbCrlf,"
") '************************************************ '/----------------------------------------------\ '>*************** Validation *******************< '\----------------------------------------------/ errmsg="" If NOT errmsg ="" then %> Following errors were detected:
<%= errmsg %> Please click the back button on your browser, or click here and fix these errors. <% Response.end End If '************************************************ '/----------------------------------------------\ '>********** The new record is created *********< '\----------------------------------------------/ 'Comment next line out if you want the new record to appear as the last record in the guestbook Newrecord = "" Newrecord = Newrecord & "" & VbCrlf Newrecord = Newrecord & "" & VbCrlf Newrecord = Newrecord & "" & VbCrlf Newrecord = Newrecord & "" & VbCrlf Newrecord = Newrecord & "" & VbCrlf If NOT Url = "" then Newrecord = Newrecord & "" & VbCrlf End If Newrecord = Newrecord & "" & VbCrlf Newrecord = Newrecord & "
Date:" & now & "
Name:" & Name & "
Email:" & Email & "
Own Url:" & Url & "
Comments:
" & Comment & "
" & VbCrlf Newrecord = Newrecord & "
" & VbCrlf & VbCrlf If Instr(Newrecord,"") = 0 then Newrecord = Newrecord & "" End If '************************************************ '/----------------------------------------------\ '>********** Edit data.txt *********************< '\----------------------------------------------/ fn = server.mappath("data.txt") 'Find data.txt on server Set fs = CreateObject("Scripting.FileSystemObject") 'Create the FileSystem object Set htmlfile = fs.OpenTextFile(fn, 1, 0, 0) 'Open data.txt code = htmlfile.ReadAll 'Read contents of file htmlfile.close 'Close data.txt set htmlfile = nothing code = Replace(Code,"",Newrecord) 'Add the new record Set htmlfile = fs.CreateTextFile(fn) 'ReCreate data.txt htmlfile.write code 'Write contents htmlfile.close 'Close data.txt set htmlfile = nothing set fs = nothing 'Close FileSystem object ' ***************************************** %>
Thank you for signing my guestbook
View guestbook
<% Else %>
Sign my guestbook

Name:
Email:
Own Url:
Comments:
 
<% End If %>