General discussion

Locked

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.

http://builder.com.com/5100-31-5076796.html?tag=search

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.

http:\\www.nextgeneration-ministries.com\guestbook.html

http:\\www.nextgeneration-ministries.com\guestbookinfo.html

___________________________________________
guestbook.cgi -
#!/usr/bin/perl

#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");
@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{'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,
Kirk

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums