Web Development

General discussion


help with CGI script

By muchfamily ·
Listed below is a URL link that has a CGI script to create a guestbook on a web site.


When I use this script, no data is returned to me from the guestbook form this is completed. I have
included the coding below for the file - guestbook.cgi & also 2 URL's that you can review. Please troubleshoot for me & let me know that I need to do in order for this to function properly.

Please review the source code on the following web pages.



guestbook.cgi -

#variables that will be used later.
$guestbookreal = "/guestbook.html";
$return = "http://www.nextgeneration-ministries.com/guestbookinfo.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");
chop (@LINES);

open (GUEST,">$guestbookreal");

for ($i=0;$i<=$SIZE;$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{'www'} ne '') {
print GUEST "<a href=\"$in{'url'}\">";
print GUEST "$in{'www'}</a><br>\n";
print GUEST "$in{'body'}<p>\n";

close (GUEST);
print "Location: $return\n\n";

Thank you,

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Related Discussions

Related Forums