
The guestbook.cgi script allows you to define "guestbook" pages within your Web site to which visitors can add their own comments. Your Web site may include as many guestbook pages as you wish. Each guestbook page is configured by creating both an HTML page that visitors will see, and a configuration file that controls how the new-comment form will look, whether the visitor will be sent a thank-you note, whether you'll be notified of visitors, etc.
The guestbook.pl CGI script is installed in the LiveZone public CGI directory. As the example below demonstrates, this script is invoked as though guestbook.pl and its sub-directory was present in your own /cgi-bin directory.
We've included a complete working example of a guestbook for you to examine.
The text below is the complete source of an HTML page that implements a guestbook page. The page contains the special HTML comment <!--insert-here--> to determine the point in your guestbook page at which new guest comments are inserted. We recommend that you copy and paste the sample below as the starting-point for your own guestbook pages.
<HTML>
<HEAD><TITLE>Sample Guestbook</TITLE></HEAD>
<BODY BGCOLOR = "FFFFFF" TEXT = "000000">
<CENTER><H1>Sample Guestbook</H1></CENTER>
Thank you for visiting my homepage. Feel free to
<A HREF = "/cgi-bin/guestbook/guestbook.cgi/configFile">
Add</A> to my guestbook!
<HR WIDTH = "75%">
<!--insert-here-->
</BODY>
</HTML>
The LiveZone guestbook script allows you to maintain any number of guestbook pages on your Web site. You must create a guestbook configuration file for each guestbook page you use. In the sample page above, replace "configFile" with the filename of the configuration file for the particular guestbook page. The filename is relative to the directory in which your /htdocs directory lives.
For example, "/guestbook.conf" refers to the configuration file named guestbook.conf in your root directory, and "/htdocs/guestbook.def" refers to the file guestbook.def in your /htdocs directory. For security reasons, we recommend not placing the configuration file within your /htdocs directory, to prevent access by Web browsers.
LiveZone Starter package clients require an additional change: you must prefix the "configFile" with your URL directory name. For example, if your Web site URL is www.LiveZone.net/yourName, replace the HREF specification in the example above with <A HREF = "/cgi-bin/guestbook/guestbook.cgi/yourName/configFile">
For your convenience, a complete sample guestbook configuration file is available for download. This configuration file includes comments that explain the parameters you might like to change for your own guestbooks. We recommend you download this sample file and use it as the starting-point for your own guestbook configurations.
Your actual guestbook HTML pages may have any filename, and may be placed in any subdirectory from which browsers can access regular HTML pages. You must remember, however, that you must create separate configuration files, one for each guestbook page within your Web site.
Unix distinguishes between files that are read-only vs. read-write. HTML files are normally read-only files when viewed browsers using a Web server. The guestbook.cgi script, however, modifies the HTML page whenever a visitor adds a comment to it. That means that you have to manually change the Unix file system permissions on your guestbook HTML file to allow it to be updated by the guestbook.cgi script.
You must ensure that the guestbook HTML page (eg., the page below) and the directory in which you place it give read-write permission to the Web server. We recommend that the guestbook HTML be placed in a sub-directory by itself, because the Web server must have read-write permission on this directory.
For our example, we create a sub-directory /htdocs/solutions/guestbook for the guestbook we're creating for the "solutions" area of our Web site. Then, we create the actual guestbook HTML page, naming it /htdocs/solutions/guestbook/solution-guests.html. Since this is just a normal HTML page as far as the Web server's concerned, you must use the html suffix.
On a Unix terminal, we'd use the two commands below to change the file permissions:
chmod uo+rwx /htdocs/solutions/guestbook
chmod uo+rw /htdocs/solutions/guestbook/solution-guests.html
For security reasons, we won't let you access the LiveZone servers directly. Instead, you'll find a menu item in yout FTP program (such as Fetch or CuteFTP) with a name such as "FTP Site Command" or "Remote FTP Command". This menu item is used to send the Unix commands below to the FTP server to manipulate the files you've placed there:
SITE CHMOD 0707 /htdocs/solutions/guestbook
SITE CHMOD 0606 /htdocs/solutions/guestbook/solution-guests.html
The importance of the 0707 and 0606 is best understood from a Unix manual describing the chmod command. These values were selected to provide security against accidental damage, yet permit the guestbook.cgi script and Web server to access your guestbook. (As a simple reminder for those "in the know", owner, group, others; 4=read, 2=write, 1=execute.)
![]() www.LiveZone.net |
Last Updated Nov. 2009 |