Alain's Guestbook

Purpose

This guestbook has been specially designed for multiuser sites: a site-wide guestbook.pl file can be reused by multiple users by "require"ing it in their own guestbook.cgi files. Appearance is configurable through the use of "template" files, which can be edited by any GUI Webpage editor.

Download

guestbook.tar.gz

Multi-User setup

  1. The administrator should put the guestbook.pl script to a place accessible to all users of the system (such as /usr/local/lib/guestbook/guestbook.pl)

    The administrator should also make sure that the users have the right to run cgi scripts (Set "Options ExecCGI" in /etc/httpd/httpd.conf), and that those cgi scripts run under the user's privileges (suexec).

    Moreover, certain templates use image links. These images should be copied to a place which is visible from the web (Apache's "icons" directory), and the templates should be adapted, if needed (by default, the images point to /icons/guestbook/template/image.jpg). If you just copy guestbook's "icons" subdirectory to /usr/local/httpd/icons/guestbooks, the templates should work as is.

  2. Each user then just copies the guestbook.cgi example from /usr/local/lib/guestbook/examples/guestbook.cgi to his Web directory, and customizes it to his taste. The following variables can be set in this script:

Single-user setup

The user needs privilege to run cgi scripts. If so, he can just install guestbook into any of his directories, and require it from his guestbook.cgi file:

require "/home/tom/guestbook/guestbook.pl";
If you don't have access to your web servers icon directory, choose another directory, and adapt the links in the templates files.

Guestbook Template Syntax

The guestbook template file is mostly a html file, and could even be edited using a HTML editor such as Netscape or Frontpage.

The template contains must contain two markers to mark the area where messages will be displayed: BEGIN_MESSAGE and END_MESSAGE, and a number of variables (such as ${mail}, ${body}, ${$maillink}). The text between those markers are repeated once for each message, and the variables are substituted with their value:

For each message:
${email}
the signer's e-mail address
${fullname}
the signer's full name
${maillink}
a mailto: link pointing to the signer's email address (and having the full name as text)
${body}
the body (contents) of the entry
Global variables:
${username}
the username variable of the guestbook.pl script.

Other goodies (to be placed in the same directory as guestbook.cgi)

thanks.html file
If it exists, this file is displayed to any visitor after he submitted a new entry. If it doesn't exist, the visitor is sent back to the main page (containing the submission form and all entries that have been submitted)
whoru.html file
This file is displayed to visitors which neither supply their name nor their e-mail address
nospam.txt file
Protection against guestbook spam. This file contains a list of forbidden words or phrases (one per line, empty lines are ignored). Guestbook submissions containing any of these are rejected.
guestbook.txt file
The actual guestbook. It is a plain text file, and can easily be edited (for instance to remove offensive entries/test entries). However, when hand editing this file make sure to respect its format: Entries are separated by a period on a line by its own. If a visitor actually entered a line solely composed of periods, then an extra period is added automatically to distinguish it from the "end of message" marker.

Pre-written templates

The following pre-written templates are available in the "templates" directory.
simple.html: source
simple text based without tables
darwin.html: source
rounded quarterframes, as found after the stories on the "Darwin Awards" web site's slush pile
linuxtoday.html: source
Like Linux-today
slashdot.html: source
every self-respecting geeks' favorite: Slashdot look

We used to have live guestbooks examples for each of those styles, but unfortunately they seemed to be getting more spam than legitimate tests. Over the years, the hassle to keep this spam-free was just too much, especially considering that nowadays guestbooks are no longer much used. Sorry.

Alain Knaff