U-M ITS Web Hosting


home / how-to / cgi-scripts / guestbook


  1. guestbook writes visitor comments to a file in your IFS home directory. You will need a special directory called cgi-data in your Public/html space and you will also need to give Guestbook permission to save changes there. Issuing the following commands on a login.itd.umich.edu server will set things up properly ( be sure to replace uniqname with your uniqname ( or your group name ):
  2.     % mkdir -p ~uniqname/Public/html/cgi-data
        % fs sa ~uniqname/Public/html/cgi-data umweb:servers rlidw
        % touch ~uniqname/Public/html/cgi-data/guestbook.html
  3. Once this is done you can use http://cgi.www.umich.edu/cgi-bin/guestbook/uniqname as your guestbook submission form. Again, be sure to replace uniqname with your uniqname in the URL above.
  4. After submitting comments using the guestbook form, your guestbook will be located at http://www-personal.umich.edu/~uniqname/cgi-data/guestbook.html
  5. You can customize your guestbook form by copying the html source of http://cgi.www.umich.edu/cgi-bin/guestbook/uniqname and creating a new page in your Public/html directory. Your form must contain at least the fields labeled comments and realname. You can also customize your Public/html/cgi-data/guestbook.html by editing that file in any way you wish, provided you do not remove the line stating:

Note that anything may be submitted in either the comments or realname fields. User's of guestbook are not guaranteed of the user's identification. No verification is performed.

Groups who use guestbook will have their guestbook pages served off the cgi.www.umich.edu server. For help, contact webmaster@umich.edu.

customize your guestbook

Feel free to modify your guestbook form and html in any way you like, but be sure not to delete the following line:


New guestbook entries are insterted after that line. If you delete that line your guestbook will start working in reverse.

For example, if you want to remove garbage entries, feel free to edit your ~/Public/html/cgi-data/guestbook.html file, and delete the lines that make up that entry.

The fields that guestbook keeps track of are:

url - This is the URL entered by the individual signing your guestbook. This URL is used as a link for that person's name.

realname - This is what the individual enters as a real name.

email - An email address for the individual. If this is left blank, nothing is printed.

city - The city the individual enters. If this is left blank, nothing is printed.

state - The state the individual enters. If this is left blank, nothing is printed.

country - The country the individual enters. If this is left blank, nothing is printed.

comments - Any comments the individual enters. This is usually a multi-line field.

successURL - The URL to which a successful guestbook submission is directed. If this is left blank, then it gives a stock success message.

ccme - If this is set to "yes", then email will be sent to the uniqname that owns the page notifying it of the guestbook submission.

ccmeSubject - If this is set (and ccme above), the value will be used in the subject of the notification email. This is intended for those who are using several guestbooks, so the email will specify which has received the posting.

filename - an alternative filename, for maintaining multiple guestbooks in the same home directory. For example, if filename is set to "stories.html" with the tag:
<input type="hidden" name="filename" value="stories.html">
The file will be stored in ~/Public/html/cgi-data/stories.html
Note that slashes ( / ) are not allowed in this filename.

Your form can be changed to include any of these fields, or more fields than this. The only fields that are required are realname and comments.

Guestbook now adds div and span tags with each new entry. This means that you can use a Cascading Style Sheet (CSS) to override the appearance of those elements. This should not affect the default look of existing guestbooks. However, if you do add styles, they may not work properly with older entries until those tags are added.

You can use our example to append comments to these instructions.

Reducing guestbook spam

It can be annoying when your guestbook attracts unwanted visitors. Sometimes spammers will try to insert comments and or links into your guestbook in order to launch a Google bomb.

One way to prevent this would be to insert this tag before your guestbook:

<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />

This will tell robots (i.e. web search engine spiders) to ignore following content. The less often that robots index the page, the less attention you'll get from spammers, and it may even deter some automated spamming agents as well.

You can also implement a robots.txt file. This can prevent robots from crawling your site, or limit them if you choose to allow them. Information about robots.txt can be found here. Information about the Robots Exclusion Standard can be found on Wikipedia here.

User Comments ( add )

Thursday, June 02, 2005 -- 03:47:15 (EDT)
Name: jerel --
  • Laddy, thast a great work i think;-)!!!

  • Tuesday, May 31, 2005 -- 20:36:02 (EDT)
    Name: Carl von Buelow --
  • Nice script. Is it possible for me to get the source code to use on another site?

  • Monday, May 30, 2005 -- 02:41:17 (EDT)
    Name: Gus
  • Best guset book =)

  • Monday, May 30, 2005 -- 00:16:12 (EDT)
    Name: sdfs
  • sdfsdf

  • Sunday, May 29, 2005 -- 18:43:55 (EDT)
    Name: john
  • "Sailing Away", by John S.
    "Singing", by Scarlett A.

  • Sunday, May 29, 2005 -- 18:42:45 (EDT)
    Name: John --
  • test

  • Sunday, May 29, 2005 -- 15:14:41 (EDT)
    Name: dfg
  • sfdsdf

  • Thursday, May 26, 2005 -- 14:12:20 (EDT)
    Name: blah blah --
  • BLAH!!!

  • Tuesday, May 17, 2005 -- 20:32:16 (EDT)
    Name: test
  • &#20013;&#25991;&#28204;&#35430;

  • Wednesday, March 30, 2005 -- 03:13:50 (EST)
    Name: `
  • w

  • Tuesday, March 22, 2005 -- 21:22:48 (EST)
    Name: fgfg --
  • fg fdgfdg

  • Tuesday, March 15, 2005 -- 17:23:05 (EST)
    Name: bob
  • bob

  • Wednesday, March 09, 2005 -- 11:18:23 (EST)
    Name: Amp
  • 1 & 2 & 3

  • Thursday, January 20, 2005 -- 20:45:41 (EST)
    Name: Michael Smith
  • I've been recently getting some guestbook SPAM, so I will try the no robots tag to see if that reduces the amount. I'm glad I checked back here.

  • Thursday, January 06, 2005 -- 18:23:54 (EST)
    Name: kevin mcgowan
  • willie is my hero. nice work, laddy!

  • Wednesday, January 05, 2005 -- 10:37:02 (EST)
    Name: Willie --
  • I added some new features to guestbook yesterday. Please read about ccmeSubject, and the new div and span classes added to each new entry.

  • Thursday, August 05, 2004 -- 14:20:34 (EDT)
    Name: SPATIL --
  • How do I delete old comments from the guest book.
    For example, I tested while I composed my guest book.

  • Tuesday, July 20, 2004 -- 13:40:05 (EDT)
    Name: Birgit
  • instructions were very helpful!