Guest Book Script
Based on a guestbook perl script by Matt Wright (mattw@worldwidemart.com).
I added a built-in form that allows the user to review their entry as
it will look in html before saving it to the file. It preserves the
data during review in a form on the same page for editing.
No temporary files are necessary.
If you are currently using Matt's Guestbook script then my [guestbk2.pl] (12/4/95) can replace the
addguest.html and guestbook.pl (.cgi) files. Just make sure you point
your 'Add' link in the guestbook to the guestbk2.pl (.cgi).
The new script can use the same [guestbook.html] and [guestlog.html] files. If you have an older
version change the <META begin> to <!--begin--> where you
want new entries to appear in the guestbook.
See [Matt's Scripts]
for the original guestbook script, instructions and related files.
You are welcome to [View my Guestbook] or [Add] an entry to try out this script.
David Efflandt efflandt@xnet.com
- [Comment Form]
Modifications to Original Script
- If you GET the script, it will provide a form for data entry.
There are buttons for Test Entry, Final Entry and Reset.
- If you POST to the script with the Test Entry button or
any other form (like addguest.html) the script will come up with the
entry in html for review along with a form for editing existing data.
Buttons will again appear for Test Entry and Final Entry so any editing
can be tested.
- If you POST to the form with the Final Entry button
(name="final") the data will be saved and logged.
- External `date` programs and formats vary on different systems, so I
use perl localtime functions to get the date.
- Our server does not resolve REMOTE_HOST so I added code to resolve
the remote host from the IP address or log the IP address if that fails
(firewalls, etc.).
- I also condensed many of the single ' if ' statements to reduce the
lines of code.
6/2/97 added line to weed out <script> tags abused by hackers.
Script Variables
- $server and $cgiurl are automatic from the environment
- $guestbookurl = "/~yourname/guestbook.html"; # - URL path to guestbook
- $guestbookreal = "/home/yourname/public_html/guestbook.html"; # - UNIX path
- $guestlog = "/home/yourname/public_html/guestlog.html"; # -
UNIX path to log
- $tz = "CST" # - Standard Time zone
- $dst = "CDT" # - Daylight Savings Time zone ($tz if none)
Standard time or daylight time is automatically selected.
If you select to be advised of entries by Email:
- $mailprog = '/usr/lib/sendmail';
- $recipient = 'you@your.com';
Accessed 122933
times since 1/1/99.
efflandt@xnet.com
Sample guestbook.html and guestlog.html
Save this page, cut each block of text below and paste to files:
Guestbook
Guestbook
Thank you for visiting our pages. We would love it if you would
Add to this guestbook we are keeping!
Guestbook Short Log
Short Log of Guestbook Entries
Below are the entries to the guestbook by domain and time. Included are
those that had errors and are noted by ERR.