if there's CGI input data {
if you can open the guestbook file {
attain an exclusive lock on the file
append the data to the file in the proper format
close the guestbook file
} else {
output an error message
}
}
output the form and the guestbook,
with a shared lock on the guestbook while reading it
Note that a program of this sort is vulnerable to abuse on at least
two fronts. First, guestbook data may contain HTML tags or HTML-like
sequences which invalidate the remainder of the guestbook or exploit
the server. You can prevent this by escaping any HTML special
characters in the stored data, if you don't mind sacrificing the
ability to have arbitrary HTML code in input guestbook data. Second,
guestbook data could be so voluminous that it prohibits the guestbook
from functioning effectively or fills your disk quota. So, you may
wish to truncate or reject guestbook data that exceeds a certain size.
<kinzler@cs.indiana.edu> 4 March 1996