Ineedhelpplease has asked for the wisdom of the Perl Monks concerning the following question:
#!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"; <html><body> <p>$bbfile is not found- something is wrong</p> </body></html> $tempfile="c:\\webserver\\osarr.org\\www\\member\\bboard\\bb.html"; if (($in{'name'} eq "") || ($in{'email'} eq "") || ($in{'comments'} eq "")) { print <<"PrintTag"; <html><body> Please complete all fields before submitting your message to the OSARR + Discussion Board. <br><br>Please complete:<br> 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 "</body></html>\n"; exit(0); } if (-e "glock.fil") { print <<"PrintTag"; <html><body> The OSARR Discussion Board is in use. Please try again later. </body></html> PrintTag exit(0); } open(LOCKFILE, ">glock.fil"); open(BBFILE,"$bbfile") ||die "Can't find the discussion board.\n"; @indata=<BBFILE>; close(BBFILE); open(TEMPFILE,">$tempfile") || die "Can't find this temporary file wha +t 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 =~ /<!--BEGINNING-->/i) { print TEMPFILE "<p><a href=\"mailto:$in{'email'}\">"; print TEMPFILE "$in{'name'}"; print TEMPFILE "</a>"; print TEMPFILE "<br>"; print TEMPFILE "$in{'comments'}</p><hr>\n\n"; } } close (TEMPFILE); rename("$bbfile", "$bbfile.old"); rename("$tempfile", "$bbfile"); #close and unlink lock.fil close (LOCKFILE); unlink("glock.fil"); print <<"PrintTag"; <html><body> Your entry has been posted to the OSARR Discussion Board<Br><br> View <a href="$url">OSARR Discussion Board</a> </body></html> PrintTag #endprogram
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Having trouble with a Discussion Board
by b10m (Vicar) on Jan 28, 2004 at 18:28 UTC | |
by Ineedhelpplease (Novice) on Jan 28, 2004 at 22:06 UTC | |
by b10m (Vicar) on Jan 29, 2004 at 02:12 UTC | |
by Ineedhelpplease (Novice) on Jan 29, 2004 at 15:35 UTC | |
by b10m (Vicar) on Jan 29, 2004 at 16:56 UTC | |
|
Re: Having trouble with a Discussion Board
by ysth (Canon) on Jan 28, 2004 at 18:32 UTC |