% Sub ReadGuestBook Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile(Server.MapPath("guestbook-data.txt")) Do Until objFile.AtEndOfStream strGuestbook = strGuestbook & objFile.ReadLine Loop 'strGuestbook = objFile.ReadAll Set objFile = Nothing IF Request("action") = "sign" Then IF Trim(Request.Form("name")) <> "" AND Trim(Request.Form("msg")) <> "" AND IsNotFilth(LCase(Trim(Request.Form("name"))),LCase(Trim(Request.Form("msg")))) Then 'add new entry strGuestbook = Trim(Request.Form("name")) & Chr(9) & Day(Date) & " " & MonthName(Month(Date),1) & " " & Year(Date) & Chr(9) & Trim(Request.Form("msg")) & vbcrlf & strGuestbook Set objFile = objFSO.CreateTextFile(Server.MapPath("guestbook-data.txt")) objFile.Write strGuestbook Set objFile = Nothing strMsg = "
Thank You. Your message was added.
" Else strMsg = "Please Enter your Name AND Message.
" End IF End IF Response.Write strMsg & vbcrlf IF Trim(strGuestbook) <> "" Then arrList = Split(strGuestbook,vbcrlf) For I = 0 To UBound(arrList) IF Trim(arrList(I)) <> "" Then arrEntry = Split(arrList(I),Chr(9)) strName = arrEntry(0) strDate = arrEntry(1) strMsg = arrEntry(2) Response.Write "" & strName & " - " & strDate & "
|