#!/usr/local/bin/perl5 ############################################################################## # WWWBoard Version 2.0 ALPHA 2 # # Copyright 1996 Matt Wright mattw@worldwidemart.com # # Created 10/21/95 Last Modified 11/25/95 # # Scripts Archive at: http://www.worldwidemart.com/scripts/ # # # # Modified by Schaft for Best Internet users 4/97 # # # ############################################################################## ############################################################################## # Define Variables - See Write-up below for the reasons for these settings # ############################################################################## # # NOTE: In the "new_file" subroutine, a command is included # to set the new files to 664 # $basedir = "."; # The changes in the program make these $baseurl = "."; # entries just "." so it will work for # either www.you.com/wwwboard or the long form # shellxx.ba.best.com/~you/wwwboard $cgi_url = "wwwboard.cgi"; #make sure this is "chmod 750" $mesgdir = "messages"; # make sure this is "chmod 730" $datafile = "data.txt"; # don't forget to "chmod 760 " $mesgfile = "wwwboard.sht"; # don't forget to "chmod 760" $faqfile = "faq.html"; $ext = "htm"; $title = "Qwxyz Forum"; # You can change this to "My WWWBoard" # or some such to personalize it ########################################################### # Configure Options # ########################################################### $show_faq = 0; # 1 - YES; # 0 = NO $allow_html = 0; # 1 = YES, HTML will show # 0 = NO, HTML will be deleted $quote_text = 0; # 1 = YES, and editable # 0 = NO, old text not in entry box $subject_line = 0; # 0 = Quote Subject Editable; # 1 = Quote Subject UnEditable; # 2 = Don't Quote Subject, Editable. $use_time = 1; # 1 = YES; 0 = NO ####################### # N E W ####################### # mail stuff - if you want to be notified of entries # # This will cause a mail message to be sent to you whenever # an entry is made in the WWWBoard message area. # # By default, no mail will be sent # $mail_me = 0; # 0 = don't mail, 1 = mail $yourname = ""; # put your login name here # For mail, the entries would look like: # $mail_me = 1; # $yourname = "your_login_name"; # # Where "your_login_name" is the name you use to log into Best # Example - For me it would look like: # # $mail_me = 1; # $yourname = "schaft"; # # #################################################################### # # Rational For Changes # ##################################################################### # The following changes were made specifically for Best Internet users # who have the capability to run CGI from their own area. # # The CGI area is a sub-directory of the directory "ftp" and is # called "public_html". The server runs as user "nobody" in the # group "mosaic", and its base directory is the user's "public_html" # when it is invoked. # # The server will not allow files to be created in a directory that is # running a script, so the normal placement of these files, and the # permissions, are: # # ftp --------- 755 <--directory # my_stuff ---- 755 <--anonymous FTP directory # etcstuff ---- 755 <--another anonymous FTP directory # # public_html - 710 <-- CGI directory # index.html - 740 <-- default page # script.cgi - 750 <-- a script # counterpg1 - 760 <-- a file that is appended to # mypic1.gif - 740 <-- a picture # # wwwboard ------ 710 <-- directory for this set of programs # wwwboard.cgi - 750 <-- executable # wwwadmin.cgi - 750 <-- executable # data.txt ----- 760 <-- modified for attachment counts # passwd.txt --- 760 <-- modifiable admin password storage # wwwboard.html -760 <-- modified display page # faq.html ------740 <-- FAQ page, displayed only # # messages ------730 <-- Directory for new messages, writable # 1.html ------664 <-- new file, owned by "nobody" so set # world readable so it can be deleted # without running "wwwadmin.cgi" # ################################################################# # MORE CHANGES, ETC. ################################################################## # Jan 97 Changes # # There are a bunch more changes - doing a "chmod" in the # NEWFILE routine, and changing the follow-up CGI address in the NEWFILE # to "../wwwboard.cgi" since it executes in the "messages" directory # # I also changed the $basedir to just a "." in a couple of places # because it shows better that the page is off of the main page. # # I lined up the boxes with a "
..." set of tags in # both the HTML and this routine. Also made them 65 characters # (there was an inconsistency between the HTML and this script) # and put in the "wrap physical" tag for browsers that support it. # # I put a
/g; # change two returns into
$body =~ s/\n/
/g; # change one return into
}
else {$error_indic = 1;} # NO MESSAGE
if ($quote_text == 1){
$hidden_body = "$body";
$hidden_body =~ s/>/>/g;
$hidden_body =~ s/</g;
$hidden_body =~ s/"/"/g;
}
# new check for E-Mail - must be at least x@y.z if it exists
# check and do the error routine if there is an email address, but it
# is not in the correct format
if ( $FORM{'email'} && ($FORM{'email'} !~ /.+\@.+\..+/) )
{ $error_indic = 1; }
else {$email = $FORM{'email'};}
# Go to the error routine if there were any errors.
&error($error_indic) if $error_indic;
# No errors, so we are here. (If there are errors, no return from subroutine)
return(1);
}
##############################################
#
#####################
# New File Subroutine
####################
sub new_file {
open(NEWFILE,">$basedir/$mesgdir/$num\.$ext") || die $!;
#### CHANGE to set file permissions to "664" and lock access #####
flock(NEWFILE,2); # lock the file
$Filenew = "$basedir/$mesgdir/$num\.$ext";
chmod 0664, $Filenew;
### ####################
print NEWFILE "\n";
print NEWFILE "
\n"; print NEWFILE "Posted by "; if ($email) { print NEWFILE "$name on $long_date:
\n"; } else { print NEWFILE "$name on $long_date:
\n"; } if ($followup == 1) { print NEWFILE "In Reply to: $origsubject posted by "; if ($origemail) { print NEWFILE "$origname on $origdate:
\n"; } else { print NEWFILE "$origname on $origdate:
\n"; } } if ($message_img) { print NEWFILE "
\n";
}
print NEWFILE "$body\n";
print NEWFILE "
\n";
if ($message_url) {
print NEWFILE "
\n";
print NEWFILE "Follow Ups:
\n";
print NEWFILE "
\n"; print NEWFILE "Post a Followup
\n"; #### --- The next line does a post to "../wwwboard.cgi" to # back up out of the messages directory print NEWFILE "