##############################################################################
# Guestbook Version 2.3.1#
# Copyright 1996 Matt Wrightmattw@worldwidemart.com#
# Created 4/21/95 Last Modified 10/29/95 #
# Scripts Archive at: http://www.worldwidemart.com/scripts/#
##############################################################################
# If you run into any problems while trying to configure this scripts, help#
# is available.The steps you should take to get the fastest results, are:#
# 1) Read this file thoroughly #
# 2) Consult the Matt's Script Archive Frequently Asked Questions: #
# http://www.worldwidemart.com/scripts/faq/#
# 3) If you are still having difficulty installing this script, send #
#e-mail to: scripts-help@tahoenet.com#
#Include any error messages you are receiving and as much detail #
#as you can so we can spot your problem.Also include the variable#
#configuration block that is located at the top of the script. #
##
# Hopefully we will be able to help you solve your problems.Thank you. #
##############################################################################
# COPYRIGHT NOTICE #
# Copyright 1996 Matthew M. WrightAll Rights Reserved. #
##
# Guestbook may be used and modified free of charge by anyone so long as #
# this copyright notice and the comments above remain intact.By using this #
# code you agree to indemnify Matthew M. Wright from any liability that#
# might arise from it's use. #
##
# Selling the code for this program without prior written consent is #
# expressly forbidden.In other words, please ask first before you try and#
# make money off of my program.#
##
# Obtain permission before redistributing this software over the Internet or #
# in any other medium.	In all cases copyright and header must remain intact.#
##############################################################################

There are five files included in the Guestbook package. Below is a brief summary of them:

  1. README - This file.
  2. guestbook.pl - The Perl Script.
  3. guestbook - The actual guestbook file.
  4. addguest - The fill-out form for a guestbook entry.
  5. guestlog - A short log of those who have added.


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. There are a few things that need to be changed in this file:

    Set Variables

    $guestbookurl
    The url address of your guestbook file.

    $guestbookreal
    The system location of your guestbook file.

    $guestlog
    The system location of your guestlog file.

    $cgiurl
    The url portion of the address to the guestbook.pl file The file guestbook.pl needs to be placed in your server's cgi-bin and chmoded read/execute for users of your httpd. (chmod a+rx)

    New in Version 2.1

    There are now several options that you have to decide whether or not to use. Below is a brief description of what each one does. While choosing what options you want to have on keep in mind that a '1' will turn them on and a '0' will turn them off.

    $mail
    This option will allow you to be notified via an E-Mail address when a new entry arrives in your guestbook. The entry will be mailed to you as a notification. If you should choose to turn this variable on you will need to fill in the 2 variables that go along with it:

    $recipient
    Your E-Mail address, so that the mailing program will know who to mail the entry to.

    $mailprog
    The location of your sendmail program on your host machine.

    $uselog
    This will allow you the ability to use my short log feature. It is already turned on so you will have to change it to 0 if you do not wish to use it. I have implemented this feature, since there are probably many people who feel no need to have a log when people are making entries to a file anyway. Keep in mind it will show errors which is one nice aspect about it.

    $linkmail
    Turning this option on will make the address links in your guestbook become hyperlinked. So instead of simply having (name@some.host) it will put (<a href="mailto:name@some.host">name@some.host</a>) so that anyone can simply click on the address to email them.

    $separator
    While looking at many other guestbooks I noticed that many people prefer to separate entries with a Horizontal Rule <hr> instead of a Paragraph Separator <p>, which I used in my old scripts. I have now given you the option to choose. By changing the 0 in the script to a 1 you will turn on the <hr> separator and turn off the <p> separator. The 0 option will do the reverse of that; turn on <p> and turn off <hr>.

    $redirection
    Although Netscape and other browsers handle the auto-redirection that I have implemented quite nicely, I have noticed that it does not work with lynx (a text based browser). I have given you the option of using auto-redirection or not. Lynx can still add to your guestbook with it, they will just get an error message when they do. This may not be true for all systems though. It seemed that when we upgraded to httpd 1.4 this problem started occurring. By choosing 1 you will enable auto redirection and 0 will return a page to the user telling them their entry has been received and click here to get back to the guestbook.

    New in Version 2.2

    here are a couple new options in version 2.2, which you will need to configure, or leave as default.

    $entry_order
    When this script was first written, entries were always added next to the top, so you and other users did not have to always see the same guestbook entry when they visited your pages. The rest of the enties scrolled beneath the newest, from newest to oldest. I have had requests that I make an option available so that people can have a guestbook which would read from oldest to newest. This is how you would go about doing that. Set this option to '0' and the newest entries will be added below the rest of the entries. Keep this option at '1' and the guestbook will act like previous versions, adding the newest entry to the top.

    $remote_mail
    Many users of the guestbook 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. You can specify the contents of the mail mesage by editing the section of the script that sends mail to the remote user. By default it sends a message that says, "Thank you for adding to my guestbook." and then shows them their entry. If you should choose to turn this variable on you will need to fill in the 2 variables that go along with it:

    $recipient
    Your E-Mail address, so that the mailing program will know who to mail the entry to.

    $mailprog
    The location of your sendmail program on your host machine.

    New in Version 2.3

    There is one new configurable option in version 2.3 of the guestbook.

    $allow_html = "";
    This option allows you to turn on or off the use of HTML tags by users of your guestbook. Setting this variable to '1' allows users to imbed html tags such as <b> or <H1> or <a href=""></a> into your html document. Setting this variable to '0' will not allow them to use any html syntax in their comments or any other field. You can still link to their email address by turning $link_mail to '1'.

    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 file. This helps to eliminate the need for allow_html to be turned on, and lets users point you to a spot that will tell you more about them. Several users of the guestbook script have asked for this option. If you wish to disable the option, simply delete the following line from your addguest file:
    URL: <input type=text name=url size=50><br>

    New in Version 2.3.1

    $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 html thing to retain the look of the guestbook entry. Common setting would be off, because sometimes people accidentally put in extra line breaks.

guestbook

This is the file that you will link to that will contain the Guestbook Entries. You will need to have this set at write/read permission for the users (chmod a+rw). You will probably need to edit the url for the link to the addguest file and edit the url at the end of this page to point back to your home page. You will also want to edit the title and heading spaces. Do not delete the line <!--begin--> from this guestbook, or else the script will have no way of knowing where to begin the editing. The <!--begin--> line is the only necessary line in your guestbook file, but the link to the addguest file is also a good idea. :)


addguest

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. You will also need to change the action of the form to point to the guestbook.pl file you placed in your cgi-bin. The action of the form should be the same as the $cgiurl variable you configured in your guestbook.pl file.


guestlog

This is a short log that lists domains and times that entries were created. Much easier to browse and it will point out those failed entries when users did not specify a name or comments. This file will also need read/write permission given to it. To avoid long scripting (call me lazy if you want :-) ) I left the log file so that newest entries are added at the bottom. This should be apparent though since the entries all come with a short date added. You can get around using this by changing the option $uselog in the guestbook.pl file.