Guestbook

One very good method for adding a guest book to your web site is to use one the written by a well-recognized Perl script author, Matt Wright who makes it available for download via the web.

Installation Procedure: 

  1. Locate and download the following files from Matt's Script Archive
    • guestbook.cgi - The Perl script which adds to the guestbook.html. 
    • addguest.html - The form that users fill out to add their entry.
    • guestbook.html - The guestbook file that contained the users' entries.
    • guestlog.html - The short log of all guestbook entries. (optional)

  2. Create a subdirectory named "guestbook" within your web site and upload both guestbook.html and guestlog.html to the new directory.

  3. Change the first line of the Perl script to reflect the official path to Perl on our server: 
  4. #!/usr/local/bin/perl
     

  5. There are a few more things that need to be changed in the Perl script: 
  6. # Set Variables

    $guestbookurl - The URL address of your guestbook.html file
    $guestbookreal - The system location of your guestbook.html file
    $guestlog - The system location of your guestlog.html file
    $cgiurl - The URL portion of the address to the guestbook.cgi file

    The second and third variables call for a system path which is not the same as a URL. If your domain name is 'yourdomain.com' the system path would be /u/web/yourdo where "yourdo" is the account userid.

    As such, the Set Variables section of the Guestbook script would follow this format: 

    # Set Variables

    $guestbookurl = "http://www.yourdomain.com/guestbook/guestbook.html"
    $guestbookreal = "/home/<userid>/public_html/guestbook/guestbook.html"
    $guestlog = "/home/<userid>/public_html/guestbook/guestlog.html"
    $cgiurl = "http://www.yourdomain.com/guestbook.cgi"
    $date_command = "/usr/bin/date"

    Be sure to substitute your domain name and userid in the example above. The path to "date" is properly set.

  7. Upload the "guestbook.cgi" script to your public-html directory in ASCII transfer mode. You will need to place the appropriate permissions on the files that need to execute. Do a chmod 750 to the perl script.

  8. Modify the form ACTION attribute within "addguest.html" to reference the guestbook script as shown below and upload to the "guestbook" directory.
  9. <FORM METHOD="POST" ACTION="./guestbook.cgi">
     

  10. Locate the file name guestbook.html within the guestbook directory. Click the box marked "PW" to the left of the guestbook.html file name to enable public write access. This will allow the Perl script to append data to the file guestbook.html.
You can test the script by referencing either the addguest.html or guestbook.html file via the web. 

Special Notes: 

  • Do NOT remove the <--begin--> tag with guestbook.html. This tells the Perl script where to insert new entries.
  • Some possible causes of a SERVER ERROR: 
    • - Set Variables section within Perl script inaccurate
    • - Perl script was not uploaded in ASCII transfer mode
    • - Public-write permission not set for guestbook.html (see #7 above)
  • The reference to both the date and sendmail program are correct.
  • You can modify the addguest.html and guestbook.html files to meet your own design standards.
A Few Options: 
  • Set the $separator variable to display either a horizontal line or insert a paragraph tag between guest book entries.
  • Set the $allow-html variable to allow visitors to use HTML tags within their entries.
Return to table of contents
© 2007 Univox Internet, Inc.