#!/usr/local/bin/perl
# This is the absolute pathname of the BBS file.
$guestbook="/directory/sub/sub/page.html";
# This is the url of that file on the web server.
$entriespage="http://www.server.com/~joe/bbs.html";
# This is the email address of the maintainer.
$maintainer="user\@emailaddress.com";
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
# Load the FORM variables
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
open (GUESTBOOK,">> $guestbook");
$currenttime=localtime;
# Put the new log entry in.
print GUESTBOOK "$currenttime from $ENV{'REMOTE_HOST'}
\n";
print GUESTBOOK "$FORM{name}";
if ($FORM{email} ne "") {
print GUESTBOOK " <$FORM{email}> "; }
print GUESTBOOK "\n";
if ($FORM{url} ne "") {
print GUESTBOOK "(Home Page)"; }
print GUESTBOOK "
\n"; print GUESTBOOK "$FORM{comments}
\n"; close (GUESTBOOK); # Thank the user and acknowledge # the feedback &thank_you; } &sub_error; sub sub_error { # Format an error message for the user print "Content-type: text/html\n\n"; print "\n"; print "
\n"; print "\n"; print "Form input was not proccessed. Please mail your "; print "remarks to $maintainer\n"; print "\n"; print "\n"; } sub evil_characters { print "Content-type: text/html\n\n"; print "\n"; print "
\n"; print "\n"; print "The Email address you entered contains illegal"; print "characters. Please back up and correct, then resubmit.\n"; print "\n"; print "\n"; } sub thank_you { print "Content-type: text/html\n\n"; print "\n"; print "
\n"; print "\n"; print "
\n"; print "$maintainer\n"; print "\n"; print "\n"; exit(0); }