<% 'Choose the Colors that you Want the Guestbook to look like' HeadingCellBgColor="#e5e5e5" HeadingCellTextColor="#000000" CellBgColor="#e5e5e5" CellTextColor="#000000" %> Kung Fu Canada

<% 'the data requested and stuff 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) 'Don't allow HTML Comment = REPLACE(Comment,VbCrlf,"
") 'Place a break for every new line in the Comment 'fun stuff! error validation 'Here's what's required: Name and the Comment 'The email address is not required, but if the user puts in one, the error routine checks to see if it's a valid one errmsg="
    " IF NOT REPLACE(Email," ","") = "" THEN IF INSTR(Email,"@")=0 THEN errmsg = errmsg & "
  • Email address is invalid. Please check it and try again
  • " ELSEIF INSTR(Email,".") = 0 THEN errmsg = errmsg & "
  • Email address is invalid. Please check it and try again
  • " END IF END IF IF REPLACE(Comment," ","") = "" THEN errmsg = errmsg & "
  • Comment is missing
  • " errmsg = errmsg & "
" IF NOT errmsg ="
    " THEN %>
    The Following Errors Were Detected:

    <%= errmsg %>
    • Please click the back button on your browser, or click here and fix these errors.
    <% Response.end END IF 'end of error routine Newrecord = "" 'Begin of Guestbook Entries Newrecord = Newrecord & "" Newrecord = Newrecord & "" & VbCrlf Newrecord = Newrecord & "" & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & VbCrlf 'Just a new line to make the output look cleaner If NOT Name = "" THEN 'If the Name was not left blank, then do the stuff below Newrecord = Newrecord & " " & Vbcrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf ELSE 'If the name was left blank, make sure to leave the Name as Anonymous Newrecord = Newrecord & " " & Vbcrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf END IF Newrecord = Newrecord & VbCrlf 'Just a new line to make the output look cleaner IF NOT Email = "" THEN 'If the Email address was not left blank, then do the stuff below Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf END IF Newrecord = Newrecord & VbCrlf 'Just a new line to make the output look cleaner IF NOT Url = "" THEN 'If the URL that user put in is not left blank in the sign-in page then do the stuff below. Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf END IF Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & "
    " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " Date:" & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & now & "" & VbCrlf Newrecord = Newrecord & "
    " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " Name:" & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & Name & "" & VbCrlf Newrecord = Newrecord & "
    " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " Name:" & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " Anonymous" & VbCrlf Newrecord = Newrecord & "
    " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " Email:" & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & Email & "" & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & "
    " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " Own Url:" & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " " & Url & "" & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & "
    " & VbCrlf Newrecord = Newrecord & "
    " & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & " Comments:" & VbCrlf Newrecord = Newrecord & " " & VbCrlf Newrecord = Newrecord & "
    " & VbCrlf Newrecord = Newrecord & "
    " & VbCrlf Newrecord = Newrecord & " " & Comment & "" & VbCrlf Newrecord = Newrecord & "
    " & VbCrlf Newrecord = Newrecord & "
    " & VbCrlf Newrecord = Newrecord & "" & VbCrlf Newrecord = Newrecord & "
    " & VbCrlf IF INSTR(Newrecord,"") = 0 then Newrecord = Newrecord & "" END IF 'Edit the guestbook.txt file fn = server.mappath("guestbook.txt") 'Find guestbook.txt on server SET fs = CREATEOBJECT("Scripting.FileSystemObject") 'Creating the FileSystem object SET htmlfile = fs.OPENTEXTFILE(fn, 1, 0, 0) 'Opening guestbook.txt code = htmlfile.READALL 'Reading the contents of the file htmlfile.CLOSE 'Close guestbook.txt SET htmlfile = nothing code = REPLACE(Code, "", Newrecord) 'Add the new record SET htmlfile = fs.CREATETEXTFILE(fn) 'Re-create guestbook.txt htmlfile.WRITE code 'Write contents to the file htmlfile.CLOSE 'Close guestbook.txt SET htmlfile = nothing SET fs = nothing 'Close FileSystem object 'End of the ASP CODE %>
    <% Else %>
    Name:
    Email:
    Url: http://
    Comments:
       

    <% END IF %>

    If you have any questions or comments regarding this website, please feel free
    to contact our Webmaster for more information. Thank you.