help with CGI script - TechRepublic
General discussion
April 6, 2004 at 08:40 AM
muchfamily

help with CGI script

by muchfamily . Updated 21 years, 2 months ago

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=;
chop (@LINES);
close(FILE);
$SIZE=@LINES;

open (GUEST,”>$guestbookreal”);

for ($i=0;$i<=$SIZE;$i++) { $_=$LINES[$i]; print GUEST "$_\n"; if (//) {
if ($in{’email’} ne ”) {
print GUEST ““;
print GUEST “$in{‘name’}
:
\n”;
} else {
print GUEST “$in{‘name’}:
\n”;
}
if ($in{‘www’} ne ”) {
print GUEST ““;
print GUEST “$in{‘www’}

\n”;
}
print GUEST “$in{‘body’}

\n”;
}
}

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

__________________________________________
Thank you,
Kirk

This discussion is locked

All Comments