|
|
Guestbook Generator
|
Adding spammer filtering
|
You can add spammer filtering to prevent spam, using the fspamlist.com and stopforumspam.com blocklists. To do this, open addtogb.asp; Find:
Const ForReading = 1, ForWriting = 2, ForAppending = 8 Set FileObject = Server.CreateObject("Scripting.FileSystemObject") GuestBookFile = Server.MapPath("../private/guestbook.txt") Set OutputStream = FileObject.OpenTextFile(GuestBookFile, ForAppending, True) OutputStream.WriteLine "Location: : " + strFld5 + "vbCrLf Comments : " + Replace(strFld4, vbCrLf, "//vbReturn//") + "vbCrLf Homepage : " + strFld3 + "vbCrLf E-mail : " + strFld2 + "vbCrLf Name : " + strFld1 + "vbCrLf Date : " + CStr(Now()) Set OutputStream = Nothing Set FileObject = Nothing
Replace with:
'// Anti-spam measure If IsUserBlackListed(sUIP, strFld1, strFld2) = True OR (Instr(1, strFld1, "://", vbTextCompare) > 0 OR Instr(1, strFld2, "://", vbTextCompare) > 0 OR Instr(1, strFld4, "://", vbTextCompare) > 0 OR Instr(1, strFld5, "://", vbTextCompare) > 0) Then bReject = True Else Const ForReading = 1, ForWriting = 2, ForAppending = 8 Set FileObject = Server.CreateObject("Scripting.FileSystemObject") GuestBookFile = Server.MapPath("../private/guestbook.txt") Set OutputStream = FileObject.OpenTextFile(GuestBookFile, ForAppending, True) OutputStream.WriteLine "Location: : " + strFld5 + "vbCrLf Comments : " + Replace(strFld4, vbCrLf, "//vbReturn//") + "vbCrLf Homepage : " + strFld3 + "vbCrLf E-mail : " + strFld2 + "vbCrLf Name : " + strFld1 + "vbCrLf Date : " + CStr(Now()) Set OutputStream = Nothing Set FileObject = Nothing End If '// Blacklists Function IsUserBlacklisted(sIP, sName, sEMail) bBlacklisted = False set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP") on error resume next objXMLHTTP.open "GET", "http://www.stopforumspam.com/api?ip=" & sIP, false objXMLHTTP.setRequestHeader "User-Agent", Request.ServerVariables("HTTP_HOST") objXMLHTTP.send "" if objXMLHTTP.status = 200 then If Instr(1, objXMLHTTP.ResponseText, " yes ", vbTextCompare) Then bBlacklisted = True end if set objXMLHTTP = nothing '// Check fSpamList.com set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP") on error resume next objXMLHTTP.open "GET", "http://www.fspamlist.com/xml.php?username=" & sName & "&ip=" & sIP & "&email=" & sEMail, false objXMLHTTP.setRequestHeader "User-Agent", Request.ServerVariables("HTTP_HOST") objXMLHTTP.send "" if objXMLHTTP.status = 200 then If Instr(1, objXMLHTTP.ResponseText, "True", vbTextCompare) Then bBlacklisted = True end if set objXMLHTTP = nothing IsUserBlacklisted = bBlacklisted End Function
|
|
Allowing multi-line posting allowances to your guestbook
|
Allowing line breaks in textarea's means your visitors can post multi-line comments. For example; Hello your name I just thought I'd pop by and say thankyou Whilst this was included by default in older versions of Guestbook Generator, the newer versions (1.2.3 and newer), do not. This is mainly due to the enhanced customisations that were added that prevented us from being able to "guess" which field you have set as the comments field and which textarea fields you actually want multi-line allowances. Because of this, you will need to add this functionality yourself, should you wish to do so. Adding multi-line posting allowances to your guestbook To add multi-line posting allowances to your guestbook, open addtogb.asp in a plain text editor such as ACF Notes or Notepad. Locate the following line; strFld4 = request.form("txtComments") Replace it with; strFld4 = replace(replace(request.form("txtaComments"), vbCrLf, "//vbReturn//"), "<br>", "//vbReturn//") Where "txtaComments" is your textarea/comments field name and strFld4 is it's corresponding variable (this variable can be found at the top of the addtogb.asp file) Next go to the bottom of the page and locate the line containing; <tr> <td width=10% nowrap valign=top>Comments:</td> <td width=90% valign=top align=left><%=strFld4%></td> </tr> Replace it with; <tr> <td width=10% nowrap valign=top>Comments:</td> <td width=90% valign=top align=left><%=replace(strFld4, "//vbReturn//", " <br/> ")%></td> </tr> Note: The "vbCrLf" seperates each "field" onto it's own line (saves having to guess whether or not the user is going to post comma's or other usable characters). The "//vbReturn//" tells the script to add line breaks (e.g. in multi-line posts).
|
|
Adding E-mail masking
|
E-mail masking allows you to prevent 'bots' from scraping e-mail addresses from your guestbooks, by using a little extra protection. Whilst this was included by default in older versions of Guestbook Generator, the newer versions (1.2.3 and newer), do not. This is mainly due to the enhanced customisations that were added that prevented us from being able to "guess" which field the user set as the e-mail field. Because of this, you will need to add this functionality yourself, should you wish to do so. Adding E-mail masking to your guestbook To add e-mail masking to your guestbook, open addtogb.asp in a plain text editor such as ACF Notes or Notepad. Locate the following line; strFld2 = request.form("txtE-Mail") Replace it with; strFld2 = Replace(Replace(Request.Form("txtE-Mail"), "@", " [ AT ] "), ".", " [ DOT ]") Where "txtE-Mail" is your e-mail field name and strFld2 is it's corresponding variable (this variable can be found at the top of the addtogb.asp file). Note: The [ AT ] and [ DOT ] can be whatever you wish.
IMPORTANT If you are using v1.2.4 or earlier, please refer to the following. Locate the following line; OutputStream.WriteLine "E-mail: " + strFld2 Replace it with; OutputStream.WriteLine "E-mail: " + Replace(Replace(strFld2, "@", " [ AT ] "), ".", " [ DOT ]") Where "E-mail: " is your e-mail field name and strFld2 is it's corresponding variable (this variable is set at the top of the addtogb.asp file). Note: The [ AT ] and [ DOT ] can be whatever you wish.
|
|
Step by step instructions: Using Guestbook Generator
|
Note: The following applies to Guestbook Generator version 1.2.2 and below only. 1. Load Guestbook Generator 2. In the Title box, type the title you would like for your guestbook 3. Select a background picture (if you would like one, otherwise, leave blank) 4. Select a background color 5. Select your font (default font is Verdana, default color is black) 6. Select the font size (in pixels. 11 being the norm for most site's) 7. Select whether or not to have a border, and which size Once the above is done, you can concentrate on the sizes you would like for your text boxes and 'comments' text area. Then simply click Generate. All files are generated and placed into the Guestbook folder, located in the Guestbook Generator folder.
|
|
|