#!c:\perl\bin\perl.exe
# ensure all fatals go to browser during debugging and set-up
use CGI::Carp 'fatalsToBrowser';
require "c:\\webserver\\osarr.org\\www\\cgi-bin\\cgi-lib.pl";
&ReadParse;
print &PrintHeader;
$url="http://www.osarr.org/member/bboard/bb.html";
$bbfile="c:\\webserver\\osarr.org\\www\\member\\bboard\\bb.html";
unless (-e $bbfile)
{
print <<"PrintTag";
$bbfile is not found- something is wrong
$tempfile="c:\\webserver\\osarr.org\\www\\member\\bboard\\bb.html";
if (($in{'name'} eq "") ||
($in{'email'} eq "") ||
($in{'comments'} eq ""))
{
print <<"PrintTag";
Please complete all fields before submitting your message to the OSARR Discussion Board.
Please complete:
PrintTag
if ($in{'name'} eq "")
{
print "\n Your Name\n";
}
if ($in{'email'} eq "")
{
print "\n Your Email Address\n";
}
if ($in{'comments'} eq "")
{
print "\n Your Comments\n";
}
print "\n";
exit(0);
}
if (-e "glock.fil")
{
print <<"PrintTag";
The OSARR Discussion Board is in use. Please try again later.
PrintTag
exit(0);
}
open(LOCKFILE, ">glock.fil");
open(BBFILE,"$bbfile") ||die "Can't find the discussion board.\n";
@indata=;
close(BBFILE);
open(TEMPFILE,">$tempfile") || die "Can't find this temporary file what is wrong. \n";
foreach $i (@indata)
{
chomp($i);
#copy line to temp file
print TEMPFILE "$i\n";
#insert new form data below placeholder
if ($i =~ //i)
{
print TEMPFILE "";
print TEMPFILE "$in{'name'}";
print TEMPFILE "";
print TEMPFILE "
";
print TEMPFILE "$in{'comments'}
\n\n";
}
}
close (TEMPFILE);
rename("$bbfile", "$bbfile.old");
rename("$tempfile", "$bbfile");
#close and unlink lock.fil
close (LOCKFILE);
unlink("glock.fil");
print <<"PrintTag";
Your entry has been posted to the OSARR Discussion Board
View OSARR Discussion Board
PrintTag
#endprogram