This guestbook is a customized version of the guestbook script found at Matt's Script Archive (version 2.3.1). Support for a multi-user environment, anti-spambot verification code, and other enhancements have been made to the original script.
This file contains examples of
You will need all three of these files in order for this script to work.
Create a directory called guestbook under your cgi-bin
Place all 3 HTML files in that directory.
GUESTBOOK.HTML - This is the file that will contain your Guestbook Entries. You can edit this file so that it will fit in with the rest of your site, but do not delete the line <!--begin--> from the guestbook file, or else the script will have no way of knowing where to add the entries. The <!--begin--> line is the only necessary line in your guestbook.html file, but the link to the addguest.html file is also a good idea.
ADDGUEST.HTML - This is a fill-out form to add a new entry into the guestbook. You will need to edit parts of it to correct urls and names of things, but leave the basic field names in place in the form. The action of the form has to point to
(The allow_html variable is explained below.)
This is the file that will contain all the required and optional fields from below (between the FORM tags). You may modify this file to your liking as long as you leave in the required fields (realname, comments, domain, guestbookurl, accountname and allow_html).
GUESTLOG.HTML - This is a short log that lists domains (or IP Addresses) and times that entries were created. It also logs any errors at attempts at guestlog entry. Much easier to browse and it will point out those failed entries when users did not specify a name or comments, or if e-mail is not able to be sent. You can turn off logging of good entries, and only log errors by setting the uselog variable below to 0 in the addguest.html file.
The following form fields are required in the addguest.html form. Please follow the instructions for these variables carefully...your guestbook will not work correctly without them!
Required 1: domain - This is the domain name for your web site. Do not include www. or your account name in this variable. Here is an example:
<input type=hidden name="domain" value="commkal.com">
Required 2: accountname - This is your account name...it is also your directory name that is under your domain. If you registered your own domain you would not add this field to your addguest.html form.
<input type=hidden name="accountname" value="_your_accountname">
Required 3 and 4: The realname and comments fields must exist in the addguest.html form, and these fields must be filled out by the user, for a valid guestbook entry. These fields are included with the supplied addguest.html file, and require no action by you (just don't delete or rename these fields).
Required 5: allow_html - This variable will allow users to post HTML inside your guestbook if set to 1, or prevent HTML inside the guestbook if set to 0. Because this variable must be read before processing your form, it is set differently than all the other variables. This variable is located in the form action line in the addguest.html file, and is set to 0 as a default (no HTML). To change your guestbook to allow HTML to be posted by users, find the following line in your addguest.html file:
<form method=POST action="/scripts/guestbook/guestbook.pl?allow_html=0">
and change it to this:
<form method=POST action="/scripts/guestbook/guestbook.pl?allow_html=1">
There are several optional variables that you can choose to use. If you wish to change the default value of one of the below variables, you would place a hidden field in your addguest.html form (somewhere between the <FORM> and the </FORM> tags). If you want to accept the default value, no hidden text field is required. If the field for an option already exists in the form, simply update the value to change the option, rather than adding the field again.
Below is a brief description of each option and what it does. While choosing what options you want to have, keep in mind that a value of "1" will turn them on and a value of "0" will turn them off.
Option 1: mail - This option will allow you to be notified via e-mail when a new entry arrives in your guestbook.
The default is off. To turn on mail to you, ensure that the following hidden fields are specified with the correct values in your addguest.html form: (substitute your full e-mail address for _your_email_address_)
<input type=hidden name="mail" value="1">
<input type=hidden name="recipient" value="_your_email_address_">
Option 2: linkmail - Turning this option on will make the address links in your guestbook become hyperlinked. So instead of simply having (email@example.com) it will put (firstname.lastname@example.org) so that anyone can simply click on the address to email them.
The default is hyperlink off. To turn hyperlink on, add or update the following hidden field in your addguest.html form:
<input type=hidden name="linkmail" value="1">
Option 3: separator - You have the choice between a Horizontal Rule (a solid line) <hr> or a Paragraph Separator (Blank Line) <p> as a seperator between guestbook entries.
The default is Paragraph Separator. To change to a Horizontal Rule add or update the following hidden field in your addguest.html form:
<input type=hidden name="separator" value="1">
Option 4: redirection - This option, if enabled, will display the guestbook entries as the results page upon successful submission of a guestbook entry. If disabled, the viewer will instead see a thank-you page showing their submission, with a link back to the guestbook entries.
The default is redirection off. To turn redirection on, add or update the following hidden field in your addguest.html form:
<input type=hidden name="redirection" value="1">
Option 5: entry_order - You can choose whether to add new submissions to the top or to the bottom of your guestbook entries.
The default is to add new guests to the bottom of the guestbook. To add guests to the top instead, add or update the following hidden field in your addguest.html form:
<input type=hidden name="entry_order" value="1">
Option 6: remote_mail - You have a choice whether or not to send an automated thank you (via e-mail) to a user that signs your guestbook.
The default is not to send remote mail. If you want to send remote mail, ensure that the following hidden fields are specified with the correct values in your addguest.html form:
<input type=hidden name="remote_mail" value="1">
<input type=hidden name="recipient" value="_your_email_address_">
(The above field will already be in the form if you enabled Option 1 for mail.)
<input type=hidden name="recipient_name" value="_your_name_here_">
<input type=hidden name="sitename" value="_your_site_name_here_">
Option 7: uselog - You have the option of whether to log normal entries in your guestlog.html file (see above).
The default is to log only errors. To log all entries in your guestlog.html file, add or update the following hidden field in your addguest.html form:
<input type=hidden name="uselog" value="1">
Option 8: line_breaks - This option allows you to decide whether or not you want line breaks in the comment field to be turned into <br>'s in the guestbook to retain the look of the guestbook entry as the user typed it in.
The default setting is off, because sometimes people accidentally put in extra line breaks. Multiple line breaks are omitted automatically even if this feature is turned on, to avoid large open spaces in your guestbook entries. To turn on line breaks, add or update the following hidden field in your addguest.html form:
<input type=hidden name="line_breaks" value="1">
Option 9: Multiple Guestbooks - This option allows you to have multiple guestbooks on your site. Don't try this option until you have one working guestbook and you understand the set up options and hidden text fields in the addguest.html file.
To have multiple guestbooks, you need to have another guestbook.html, guestlog.html and addguest.html file set. These files will also go in your /cgi-bin/guestbook/ directory. You should name them guestbookxxx.html, guestlogxxx.html and addguestxxx.html where xxx is something that makes sense for your wanting multiple guestbooks on your site. (Like jan, feb if you want a seperate guestbook for each month or _1, _2, _red, or whatever you like) The xxx is not limited to 3 characters, but you should use only letters, numbers or the underscore character since it is a filename. All the rules and options above apply for the 3 html files and the addguestxxx.html file would be exactly the same as above except it would contain the following hidden field: (substitue the value you added as xxx in your filenames above for xxx in value below)
<input type=hidden name="multigb" value="xxx">
Option 10: Spambot Protection - This option allows you to protect your guestbook against automated spambot submissions, which often times post links to objectionable web sites.
The default setting is on. When a guestbook entry is submitted, an image with a numerical code is returned to the submitter for verification. Upon successful submission of this numerical code, the guestbook entry is added to your guestbook. If for some reason you wish to turn off the Spambot Protection feature for your guestbook, please contact our Technical Support Department.