Hi all! I'm attempting to put a guestbook on my website. I've been following the script from "http://articles.techrepublic.com.com/5100-22_11-5076796.html".However, I'm obviously doing something wrong as once I hit submit, it goes to the file in the cgi-bin and doesn't go any further. I'm left with a blank screen. Please help! It's driving me crazy!
<form method="post" action="/cgi-bin/guestbook.cgi"> <p class="tags">Name: <input type="text" name="name" id="name" size="30" /></p> <p class="tags">E-mail address: <input type="text" name="email" id="email" size="30" /></p> <p class="tags">Website: <input type="text" name="website" id="website" /></p> <p class="tags">Comment: <textarea name="comment" id="comment" rows=3 cols=45 wrap=virtual></textarea></p> <br /> <input type="submit" name="submit" value="POST to the guestbook"> <input type="reset" name="reset" value="CLEAR the form" /> </form> <!--add-->
#!/usr/bin/perl#variables that will be used later.$guestbookreal = "guest.html";$return = "http://www.damienbt.com/guest.html";read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});@pairs = split(/&/, $buffer);foreach $pair(@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/<\!\-\-.*\-\->//g; # get rid of SSI $in{$name} = $value; }open (FILE,"$guestbookreal"); @LINES=<FILE>; chop (@LINES); close(FILE); $SIZE=@LINES;open (GUEST,">$guestbookreal");for ($i=0;$i<=$SIZE;$i++) { $_=$LINES[$i]; print GUEST "$_\n"; if (/<!--add-->/) { if ($in{'email'} ne '') { print GUEST "<b><a href=\"mailto:$in{'email'}\">"; print GUEST "$in{'name'}</a></b>:<br>\n"; } else { print GUEST "<b>$in{'name'}</b>:<br>\n"; } if ($in{'website'} ne '') { print GUEST "<a href=\"$in{'website'}\">"; } print GUEST "$in{'comment'}<p>\n"; } }close (GUEST);print "Location: $return\n\n";