Fix Forum "Explosion" Problem



Under certain circumstances, the Forum "exploded", all the posts suddenly 
disappeared. The cause of this problem is yet to be determined. Following 
is a suggested solution:

Each time when a post is added to the board, a backup copy of mainboard.html 
is saved. If the program detects that the mainboard.html is corrupted, it 
will recover it's content from the backup copy.

Please modify following section of Perl script "mainboard.pl":

Old Code:
==========================================================================

###############################
# Main WWWBoard Page Subroutine

sub main_page {
   open(MAIN,"$basedir/$mesgfile") || die $!;
   @main = <MAIN>;
   close(MAIN);

#   $bodylength = length($body);

   $bodylength = length($body) + length($message_url_title) + length($message_img);

   ...

==========================================================================

New Code:
==========================================================================

###############################
# Main WWWBoard Page Subroutine

sub main_page {
   open(MAIN,"$basedir/$mesgfile") || die $!;
   @main = <MAIN>;
   ($zzdev, $zzino, $zzmode, $zznlink, $zzuid, $zzgid, $zzrdev, $zzsize, $zzatime, $zzmtime, $zzctime, $zzblksize, $zzblocks) = stat(MAIN);
   close(MAIN);

   if ($zzsize > 0)
   {
	system("cp $basedir/$mesgfile $basedir/$mesgfile.copy"); 
   }
   else
   {
	system("cp $basedir/$mesgfile.copy $basedir/$mesgfile"); 
   	unlink("$basedir/$busyfile") || die $!;
	&error(system_busy);
   }

#   $bodylength = length($body);

   $bodylength = length($body) + length($message_url_title) + length($message_img);

   ...

==========================================================================

If the server is Windows NT, use DOS command "copy" instead of unix command "cp",
such as

	system("copy $basedir\\$mesgfile $basedir\\$mesgfile.copy"); 
and
	system("copy $basedir\\$mesgfile.copy $basedir\\$mesgfile"); 

==========================================================================