Guestbook Readme

Complete installation and configuration guide for the Guestbook CGI script version 2.3.1

Perl v2.3.1 Documentation

Table of Contents

Overview

There are five files included in the Guestbook package:

# File Description
1 README This file - installation and configuration instructions
2 guestbook.pl The Perl script that processes entries
3 guestbook.html The actual guestbook file displaying entries
4 addguest.html The fill-out form for new guestbook entries
5 guestlog.html A short log of those who have added entries

guestbook.pl

This is the Perl script that actually writes new entries to files and returns the entry to the user. This file will need to be placed in the cgi-bin of your server and chmoded to a+rx (755).

Set Variables

Variable Description
$guestbookurl The URL address of your guestbook.html file.
Example: "http://example.com/guestbook.html"
$guestbookreal The system location (absolute path) of your guestbook.html file.
Example: "/home/user/public_html/guestbook.html"
$guestlog The system location of your guestlog.html file.
Example: "/home/user/public_html/guestlog.html"
$cgiurl The URL portion of the address to the guestbook.pl file. The file needs to be placed in your server's cgi-bin and chmoded read/execute for users of your httpd (chmod a+rx).
Example: "http://example.com/cgi-bin/guestbook.pl"

New in Version 2.1

There are now several options that you have to decide whether or not to use. While choosing what options you want to have on, keep in mind that '1' will turn them on and '0' will turn them off.

This option will allow you to be notified via email when a new entry arrives in your guestbook. The entry will be mailed to you as a notification.

If you choose to turn this variable on, you will need to fill in these additional variables:

$recipient Your email address where notifications will be sent
$mailprog The location of your sendmail program (e.g., /usr/sbin/sendmail)

This will allow you the ability to use the short log feature. It is already turned on by default, so you will have to change it to 0 if you do not wish to use it.

The log feature is helpful because it will show errors, which is one nice aspect about it.

Turning this option on will make the email addresses in your guestbook become hyperlinked.

Instead of simply having ([email protected]), it will display <a href="mailto:[email protected]">[email protected]</a> so that anyone can simply click on the address to email them.

Many people prefer to separate entries with a Horizontal Rule <hr> instead of a Paragraph Separator <p>.

  • 1 = Use <hr> separator (horizontal rule)
  • 0 = Use <p> separator (paragraph)

Although Netscape and other browsers handle the auto-redirection quite nicely, it does not work with lynx (a text-based browser).

  • 1 = Enable auto-redirection back to guestbook
  • 0 = Return a confirmation page with a link back to the guestbook

New in Version 2.2

When this script was first written, entries were always added next to the top, so users did not have to always see the same guestbook entry when they visited your pages.

  • 1 = Newest entries at the top (default, like previous versions)
  • 0 = Newest entries at the bottom (oldest to newest)

Many users have requested that a form letter be automatically sent to the remote user when they fill in the guestbook.

Turning this option on will tell the script to automatically mail any user who leaves an email address. By default, it sends a message that says "Thank you for adding to my guestbook." and shows them their entry.

If you turn this on, you will need to configure $recipient and $mailprog variables.

New in Version 2.3

This option allows you to turn on or off the use of HTML tags by users of your guestbook.

  • 1 = Allow users to embed HTML tags such as <b>, <H1>, or <a href=""></a>
  • 0 = Do not allow any HTML syntax in comments or other fields

You can still link to their email address by turning $linkmail to '1'.

URL Field Feature

Also new in version 2.3 is the ability for users to add their own URL, and then their name is referenced to their URL in the guestbook.html file. This helps eliminate the need for allow_html to be turned on.

If you wish to disable this option, simply delete the following line from your addguest.html file:

URL: <input type=text name=url size=50><br>

New in Version 2.3.1

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 HTML to retain the look of the guestbook entry.

  • 1 = Convert line breaks to <br> tags
  • 0 = Do not convert line breaks (common setting, because sometimes people accidentally put in extra line breaks)

guestbook.html

This is the file that you will link to that will contain the Guestbook Entries.

Setup Instructions:

  1. Edit the URL for the link to the addguest.html file
  2. Edit the URL at the end of this page to point back to your home page
  3. Edit the title and heading sections as needed

The link to the addguest.html file is also a good idea to include for user convenience.

addguest.html

This is the fill-out form to add a new entry into the guestbook.

Setup Instructions:

  1. Edit parts of the file to correct URLs and names of things
  2. Leave the basic field names in place in the form
  3. Change the action attribute of the form to point to the guestbook.pl file you placed in your cgi-bin

Example Form Action:

<form method="POST" action="http://example.com/cgi-bin/guestbook.pl">

guestlog.html

This is a short log that lists domains and times that entries were created. It's much easier to browse and will point out those failed entries when users did not specify a name or comments.

The log file is arranged so that newest entries are added at the bottom. This should be apparent since entries all come with a short date added.

You can avoid using this file by changing the $uselog option in the guestbook.pl file to 0.

Bug Fixes

  1. Changed the guestbook script so that the subroutines now work properly. Version 2.0 had issues that weren't caught during testing.
  2. Added a complete new form in the subroutines so that people who forget to put their name in can simply fill it in, while the script retains the rest of the information. Users don't have to return to the guestbook add form to fill out the entry all over again.

  1. Fixed a huge parenthesis problem in version 2.1:
    • The mail option was missing two parentheses which caused it not to work on many machines
    • The guestbook printing had the ')' inside the <a href> mailto tag instead of outside
  2. Changed <>'s to () in guestbook email addresses for better compatibility with email clients

Thanks to Rick O'Donnell for pointing out the flaw and providing a fix.

Version History

Version Date Changes
2.3.1 10/29/95
  • Removed all references to $server accidentally left in v2.3
  • Added option to convert line breaks to <br>'s
  • Added several die routines for better error handling
2.3 10/14/95
  • Added option to allow/disallow HTML tags in entries
  • Fixed SSI security vulnerability
  • Added optional URL field for visitors
2.21 10/08/95
  • Fixed logging entry issue that caused log to appear on one line
2.2 08/23-24/95
  • Changed parenthesis to brackets for email addresses
  • Logging now a subroutine
  • Better code formatting/tabbing
  • Added entry order option (newest first/last)
  • Fixed email option to include names
  • Modified subroutines for international use
2.1 05/29-06/07/95
  • Fixed subroutines
  • Added form to subroutines for error recovery
  • Added email notification option
  • Added hyperlinked email option
  • Added log enable/disable option
2.0 05/26/95
  • Entries now appear most recent first
  • Auto-redirect after completing add form
1.1 05/13/95
  • Added chop($shortdate) to make log file more readable

Quick Reference: All Variables

Variable Type Default Description
Required Variables
$guestbookurl URL - URL to guestbook.html
$guestbookreal Path - System path to guestbook.html
$guestlog Path - System path to guestlog.html
$cgiurl URL - URL to guestbook.pl
Optional Variables (0=off, 1=on)
$mail Boolean 0 Email notification on new entry
$uselog Boolean 1 Use short log feature
$linkmail Boolean 1 Make emails clickable
$separator Boolean 0 Use <hr> (1) or <p> (0)
$redirection Boolean 1 Auto-redirect after signing
$entry_order Boolean 1 Newest first (1) or last (0)
$remote_mail Boolean 0 Auto-reply to visitor
$allow_html Boolean 0 Allow HTML in entries
$line_breaks Boolean 0 Convert line breaks to <br>
Mail Variables (if $mail or $remote_mail = 1)
$recipient Email - Your email address
$mailprog Path - Path to sendmail