I have changed Sambars Guest book .PL file like this:
#
# Sample CGI/1.1 Perl Guestbook
#
# In the event of a failure, anything written to stderr can
# be found in the "tmp" directory.

$bookfile = "../docs/ts/guestbook.htm";

# Get the input
read(STDIN, $data, $ENV{'CONTENT_LENGTH'});

# Split the name-value pairs
@pairs = split(/&/, $data);

foreach $pair (@pairs)
{
        ($name, $value) = split(/=/, $pair);

        # Convert the HTML encoding
        $value =~ tr/+/ /;
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
        $value =~ s/<!--(.|\n)*-->//g;

        # Convert HTML stuff as necessary.
        $value =~ s/<([^>]|\n)*>//g;

        $FORM{$name} = $value;
}

# Verify that the required data has been received.
&missing_name unless $FORM{'name'};
&missing_email unless $FORM{'email'};
&missing_msg unless $FORM{'msg'};

# Read in the book for editing
# Note:  These actions on the book file should be atomic (flock()).
open (FILE, "$bookfile") || die "Can't open $bookfile: $!\n";
@LINES=<FILE>;
close(FILE);
$SIZE=@LINES;

# Open book file
open (FILE, ">$bookfile") || die "Can't open $bookfile: $!\n";

for ($i = 0; $i <= $SIZE; $i++)
{
        $_=$LINES[$i];

        if (/<!--top-->/)
        {
                print FILE "<!--top-->\n";

                print FILE "<b>$FORM{'msg'}</b><br>\n";
                print FILE "$FORM{'name'}";
                if ($FORM{'email'})
                {
                print FILE "<div style=\"position: absolute; visibility:
hidden\">$FORM{'email'}</div>";
                }

                print FILE "<HR>\n";
        }
        else
        {
                print FILE $_;
        }
}

close (FILE);


# Response message.
print "<HTML><HEAD><TITLE>Thanks</TITLE></HEAD><BODY bgcolor=white>\n";
print "<FONT SIZE=5 COLOR=#996633><B>Thanks for your message</B></FONT>\n";
print "<BR><BR>Your entry has been added to our guest book:<HR>\n";
print "<b>$FORM{'msg'}</b><br>\n";
print "$FORM{'name'}";
print "<P><HR>\n";
print "<A HREF=\"/ts/guestbook.htm\">Back to GuestBook.</A><br>\n";
print "<A HREF=\"/ts/index.htm\">Back to Trowel and Sword home
page.</A><br>\n";
print "</BODY></HTML>\n";

exit;


sub missing_name
{
        print "<HTML><HEAD><TITLE>Missing Name</TITLE></HEAD><BODY>\n";
        print "<FONT SIZE=5 COLOR=#996633><B>Name field is blank...</B></FONT>\n";
        print "<BR><BR>Please repost the name section of the guestbook.<P>\n";
        print "Return to the <a href=\"/ts/guestbook.htm\">Guest Book</a>.\n";
        print "</BODY></HTML>\n";

        exit;
}

sub missing_email
{
        print "<HTML><HEAD><TITLE>Missing Email</TITLE></HEAD>\n";
        print "<FONT SIZE=5 COLOR=#996633><B>Email field is blank...</B></FONT>\n";
        print "<BR><BR>Please repost the email section of the guestbook.<P>\n";
        print "Return to the <a href=\"/ts/guestbook.htm\">Guest Book</a>.\n";
        print "</BODY></HTML>\n";

        exit;
}

sub missing_msg
{
        print "<HTML><HEAD><TITLE>Missing Comments</TITLE></HEAD>\n";
        print "<FONT SIZE=5 COLOR=#996633><B>Comment field is
blank...</B></FONT>\n";
        print "<BR><BR>Please repost the comment section of the guestbook.<P>\n";
        print "Return to the <a href=\"/ts/guestbook.htm\">Guest Book</a>.\n";
        print "</BODY></HTML>\n";

        exit;
}

I am just wondering, i would like to put the date of the mesage sent after
the name. How would i do this??

Thank You,
Tim Groeneveld,
Only 12!

-------------------------------------------------------
To unsubscribe please go to http://www.sambar.ch/list/



Reply via email to