your code works but i may be doing something wrong
can u check it for me? i am getting extra
data printed out to the file:
http://pwinquist.com/blog.html
here is the perl:
#!/usr/local/bin/perl -w
print "Content-type:text/html\n\n";
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;
$FORM{$name} = $value;
}
foreach $key (keys(%FORM)) {
"$key = $FORM{$key}\n";
}
#print MAIL "Hello Dudes . . .\n";
# print MAIL "$FORM{int1}\n";
# print MAIL "$FORM{int1}\n";
$now = localtime time;
# print "It is now $now\n";
$test1 = $FORM{comments};
$test2 = $FORM{name};
open(INFILE,"output7.txt") || die;
while(<INFILE>) { $buffer .= $_; }
close(INFILE);
$buffer = "\n\n$now\n$test2
says:\n$test1\n\n-------------------------------------------------------------------------------------------------------------------------------------\n\n" . $buffer;
open(OUTFILE,">output7.txt") || die;
print OUTFILE $buffer;
close(OUTFILE);
#reading
open(OUTFILE, "output7.txt") || die "Opening output7.txt: $!";
@test10=<OUTFILE>;
close(OUTFILE);
print <<EndHTML;
<html>
<head><title>Opinion</title> </head>
<body bgcolor=white>
Return to <a href="http://pwinquist.com/page1.html" target="_top">Las Vegas Sins & Scams</a>.
<table width=700><tr><td align=left>
<pre>
@test10 <br><br>
$buffer
</pre>
</td></tr></table>
Return to <a href="http://pwinquist.com/page1.html" target="_top">Las Vegas Sins & Scams</a>.
<hr width=100%>
</body>
</html>
EndHTML
;
sub dienice {
($errmsg) = @_;
print "<h2>Error</h2>\n";
print "$errmsg<p>\n";
print "</body></html>\n";
exit;
}
thanks