Before this page
See the advice for a novice first, where you make compulsory changes on the first line (path) and the basic set up for the url, directory, etc.
#!/usr/local/bin/perl

################
# basic set up #
################
$basurl = "http://your_url/";
$bbs = "http://your_url/bbs.cgi";
$setup = "http://your_url/setup.cgi";
$basdir = "/your_directory/";
$addrss = 'nobody@visitware.com';
$smpath = "/usr/sbin/sendmail";
$seed = "za";
$sfile = "secret.dat";
$ifile = "index.html";
     :
     :

You may make any changes but please do so after you confirm that the default CGIs work.

Simple optional changes
You may make optional changes
################
# basic set up #
################
     :
     :
$maxle = 512;
$maxno = 50;
$Interv = 3;
$lfexp = 1/48;
Please note: the above is for bbs.cgi. setup.cgi does not have $maxle nor $maxno.

where
$maxle = 512;
sets the maximum length of article to be put on the mother board. An article longer than $maxle bytes is cut to fit the mother board. To the full article, a separate daughter board is created and a link is made from the mother board.
$maxno = 50;
sets the maximum number of articles to be kept on the mother board. Older articles, including daughter boards, beyond $maxno are phased out.
$Interv = 3;
sets how long a guest sees "thank you message" after he sent comments or made a new message-board. The default is 3 seconds.
$lfexp = 1/48;
removes a lock file if a cgi is locked by an error. The default values are 1/48 of a day or 30 minutes for bbs.cgi and 1/720 of a day or 2 minutes for setup.cgi. (If more than one data strings are posted at the same time, the data would crash over a data file. Locking cgi is necessary to avoid such accident. But the lock, flagged by temp.dat, is removed soonest after the data input if everything goes ok.) A cgi processes data within seconds not minutes. An older lock must be an error and is destroyed automatically. (bbs.cgi makes allowances for a board master carrying out an administrative work. Thus the value must be much longer than setup.cgi.)

Others in "basic set up" set few wording. (take little notices of discrepancy between bbs.cgi and setup.cgi)
$dname = "Guest";
$dttle = "Untitled";
bbs.cgi only.
set the name of the guest and title posted to bbs.cgi if they are not filled.
$dall = "Delete all";
$aok = "All OK";
bbs.cgi only.
set the words in the submit buttons of a board master's administrative page. Buttons delete everything in the queue or delete nothing. (wording in the button deleting articles individually can be freely changed in the cgi.)
$admin = "administrator";
setup.cgi only.
sets how the administrator, you, want to be called by (prospective) board masters.
$togst = "Your comments have been successfully added.";
$forbm = "The operation has been completed.";
bbs.cgi only.
$togst sets "thank you message" to a guest contributing an article. $forbm sets "thank you message" for the board master finishing an administrative work.

$erro0 to $erro9 set error messages when something went wrong. As far as you do not write something misleading, you can change them.

Do not change spellings of variables start with "$". If you want to change the spelling of any words starting with "$", study perl first, otherwise the message board malfunctions. If you want to have a dollar mark inside perl, spell it \$ instead of $. (Price: $50 must be Price: \$50.) Also if you want to have @, write it \@. (So, your@mail.address must be your\@mail.address. Else perl returns an error.) A funny thing is, if you want \, it must be \\ instead. More, perl uses double quotes " for it's own. To avoid confusion, HTML double quotes within perl double quotes must be written \".

Start-admin-work page
I already mentioned index.html, the link page in the base directory which is a HTML document so that you can change it with HTML knowledge. But you can find and modify many HTMLs hidden in cgi too. You may import them to homepage authoring soft, change them, open the page sources and copy and paste them back to cgi.

First, how the start page (to create/modify/delete a message-board) looks.
#####################
# admin page starts #
#####################
     :
     :
<HTML>
<HEAD>
<TITLE>create, delete or modify your message-board</TITLE>
<BASE HREF="$basurl">
</HEAD>
<BODY>
<CENTER>
<FONT SIZE=6>This is the webmasters' administrative page.</FONT>
<P><FONT SIZE=5>If you are here by mistake, you may feel free to</FONT>
<BR><FONT SIZE=6><A HREF="$ifile">click here</A></FONT>
<BR><FONT SIZE=5>and see the list of our DoubleMessageBoards.</FONT>
</CENTER>
<HR><BR>
If you want to set up a new board, fill the below.<BR>
A new directory containing your message-board is made.<BR>
Your board url will be $basurl<B>directory_name</B>/ in which your directory name replaces <B>directory_name</B>.<BR>
<FORM ACTION="$setup" method="POST">
<TABLE>
<TR><TD ALIGN=right>Choose your ID:</TD>
<TD><INPUT TYPE="text" NAME="name"></TD>
<TD>For the administrative reason you need an unique ID for each board.</TD></TR>
<TR><TD ALIGN=right>Directory name:</TD>
<TD><INPUT TYPE="text" NAME="dir"></TD>
<TD>You can use only alphanumerics, - and _ for the directory name.</TD></TR>
<TR><TD ALIGN=right>Password:</TD>
<TD COLSPAN=2><INPUT TYPE="password" NAME="pswd1"></TD></TR>
<TR><TD ALIGN=right>Type password again:</TD>
<TD><INPUT TYPE="password" NAME="pswd2"></TD>
<TD>Please do not forget your ID and password.</TD></TR>
<TR><TD ALIGN=right>Your e-mail address:</TD>
<TD COLSPAN=2><INPUT TYPE="text" NAME="mail"></TD></TR>
<TR><TD ALIGN=right>Your homepage url:</TD>
<TD COLSPAN=2><INPUT TYPE="text" NAME="hurl" SIZE=40 VALUE="http://"></TD></TR>
<TR><TD ALIGN=right>The title of your board:</TD>
<TD COLSPAN=2><INPUT TYPE="text" NAME="title" SIZE=40></TD></TR>
<TR><TD ALIGN=right>Short description for our index page (optional):</TD>
<TD COLSPAN=2><TEXTAREA NAME="desi" cols=36 rows=3></TEXTAREA></TD></TR>
<TR><TD ALIGN=right>Short description on your board (optional):</TD>
<TD COLSPAN=2><TEXTAREA NAME="desb" cols=36 rows=3></TEXTAREA></TD></TR>
<TR><TD ALIGN=right>Background color:</TD>
<TD COLSPAN=2><SELECT NAME="color">
<OPTION VALUE="white">white
<OPTION VALUE="lightblue">lightblue
<OPTION VALUE="lightpink">lightpink
<OPTION VALUE="lightgrey">lightgrey
<OPTION VALUE="lightgreen">lightgreen
<OPTION VALUE="lightyellow">lightyellow
</SELECT></TD></TR>
</TABLE>
<INPUT TYPE="hidden" NAME="do" VALUE="new">
<INPUT TYPE="submit" NAME="submit" VALUE="create new board">
<INPUT TYPE="reset" VALUE="reset">
</FORM>
<HR><BR>
You can modify your message-board.
<FORM ACTION="$setup" method="POST">
<TABLE>
<TR><TD ALIGN=right>Your ID:</TD>
<TD><INPUT TYPE="text" NAME="name"></TD></TR>
<TR><TD ALIGN=right>Password:</TD>
<TD><INPUT TYPE="password" NAME="pswd"></TD></TR>
</TABLE>
<INPUT TYPE="hidden" NAME="do" VALUE="mod">
<INPUT TYPE="submit" NAME="submit" VALUE="modify the board">
<INPUT TYPE="reset" VALUE="reset">
</FORM>
<HR><BR>
Or you may delete your message-board went out of use.
<FORM ACTION="$setup" method="POST">
<TABLE>
<TR><TD ALIGN=right>Your ID:</TD>
<TD><INPUT TYPE="text" NAME="name"></TD></TR>
<TR><TD ALIGN=right>Password:</TD>
<TD><INPUT TYPE="password" NAME="pswd"></TD></TR>
</TABLE>
<INPUT TYPE="hidden" NAME="do" VALUE="old">
<INPUT TYPE="submit" NAME="submit" VALUE="delete old board">
<INPUT TYPE="reset" VALUE="reset">
</FORM>
</BODY>
</HTML>
setup.cgi only.
You do not change FORM field TYPEs nor NAMEs. Do not delete "hidden" fields. Do not change any words start with "$".

Please note the HTML part can be found between print <<"STRT_ADMIN"; and STRT_ADMIN. You may find similar
do_something <<"CAPITAL_LETTERS";
     :
     :
CAPITAL_LETTERS
combinations in the cgi. What comes between a pair of capitalized word is a HTML document (or a part of HTML). You can not use the particular capitalized word within the HTML (the word indicates the end of HTML). In other words
print <<"YOUR_HTML_DOC";
     :
     :
You have HTML here.
     :
     :
YOUR_HTML_DOC
     :
     :
HTML continues.
     :
     :
YOUR_HTML_DOC
does not work. HTML continues.. etc. will be ignored at best or cgi malfunctions.

Clear cache automatically
If you expect a board master uses a public internet terminal or a shared computer, you may insert following lines at the begining of the page head above.
#####################
# admin page starts #
#####################
     :
     :
print <<"STRT_ADMIN";
Cache-Control: no-cache
Pragma: no-cache

Content-type: text/html

<HTML>
     :
     :

"no-cache" will automatically remove the admin page, with ID and the password, from the cache. You also want to insert "no-cache" into
############################
# modify the board (input) #
############################
     :
     :
### modify board ###
print <<"NEW_BOARD";
Cache-Control: no-cache
Pragma: no-cache

Content-type: text/html
of setup.cgi and
#####################
# admin page starts #
#####################
     :
     :
print <<"ADMIN_PAGE";
Cache-Control: no-cache
Pragma: no-cache

Content-type: text/html
and
#####################
# editor page login #
#####################
     :
     :
### editor page head ###
print <<"HTML_HEAD";
Cache-Control: no-cache
Pragma: no-cache

Content-type: text/html
of bbs.cgi for tighter security. (Although ID and password still can be retrieved unless all cache is manually cleared after the work and they could leak while you are typing them.) What comes before <HTML> is HTTP header and you must have one blank line separating it from the body, HTML document starting with <HTML>. The HTML meta tag equivalent of this header is
<HTML>
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

     :
     :

Redo-submission page
You can change the redo page too.
#############
# redo page #
#############
     :
     :
<HTML>
<HEAD>
<TITLE>Re-try, please</TITLE>
</HEAD>
<BODY>
<CENTER>
<FONT SIZE=6>Incomplete submission!!</FONT>
</CENTER>
<FONT SIZE=5>$redo1 $redo2 $redo3 $redo4 $redo5 $redo6</FONT>
</BODY>
</HTML>
setup.cgi only.
This page is shown when an expected new user has made an incomplete submission to create a new board. You do not alter the spelling of variables from $redo1 to $redo6.

Board-is-made page
And welcome message after a new message-board is made.
#############################
# create new board (action) #
#############################
     :
     :
### Welcome ###
     :
     :
<HTML>
<HEAD>
<TITLE>Welcome :-)</TITLE>
</HEAD>
<BODY>
<BR><FONT SIZE=6>
Dear $data{'name'},
</FONT><BR><FONT SIZE=5>
Your board have been created.<BR>
It is <A HREF="$basurl$udir/$ifile">HERE</A>.<BR>
Please check if everything is OK.
</FONT>
</BODY>
</HTML>
setup.cgi only.

It is not shown above but HTTP header for the welcome page has REFRESH: $Interv;URL=$basurl$udir/$ifile. Its HTML meta tag equivalent is
<META HTTP-EQUIV="REFRESH" CONTENT="$Interv;URL=$basurl$udir/$ifile">
"REFRESH" makes the browser gets the url ($basurl$udir/$ifile or the message-board just created) after $Interv (3 seconds by default) anew. If you delete "REFRESH" line, the page will not refresh.

If you set $Interv 0 (zero) and delete from <HTML> to </HTML> but keep a blank line just after "REFRESH".
print <<"ALL_OK";
REFRESH: 0;URL=$basurl$udir/$ifile

ALL_OK

The board-master will see the new board without seeing welcome page on the way.

(I could not find a RFC document about HTTP header REFRESH. This means that "REFRESH" may not be the part of authoritative internet community yet. Indeed, "REFRESH" is invented by Netscape as a meta tag and later supported by Microsoft Internet Explorer. Using it in HTTP header might be, therefore, an abuse, though it works fine with my browser.)

Message board appearance
You can determine the way message-board is made.
##############
# board head #
##############
     :
     :
<HTML>
<HEAD>
\t<TITLE>DoubleMessageBoard</TITLE>
</HEAD>
<BODY BGCOLOR="$data{'color'}">
<CENTER>
<H1>$data{'title'}</H1>
<P>
$data{'desb'}
</CENTER>
<P>
homepage: <A HREF="$data{'hurl'}">$data{'hurl'}</A><BR>
mailto: <A HREF="MAILTO:$data{'mail'}">webmaster</A>
\t<P>
<FORM ACTION="$bbs" method="POST">
<TABLE>
<TD ALIGN=right>
Your Name:<BR>Email Address:
</TD>
<TD ALIGN=left>
<INPUT NAME="name" SIZE=30><BR>
<INPUT NAME="email" SIZE=30>
</TD>
</TABLE>
Title: <INPUT NAME="title" SIZE=40>
<P>
Comments:
<TEXTAREA NAME="comments" cols=80 rows=10 wrap="virtual"></TEXTAREA>
<P>
<INPUT TYPE="hidden" NAME="do" VALUE="add">
<INPUT TYPE="hidden" NAME="dir" VALUE="$udir">
<INPUT TYPE="submit" VALUE="OK/send">
<INPUT TYPE="reset" VALUE="reset">
</FORM>
setup.cgi only.
This is the top of a message-board. Articles posted by guests and the bottom of the board are not and should not be here. In other words, do not have closing tags </BODY> nor </HTML> here. You do not change FORM field TYPEs nor NAMEs.

More, you find two \t above. They are keystones of "prof" DMB's adaptability. You must have two and only two of them. What comes between \t can be changed later. And you can make "prof" less flexible by adjusting the position of \t. If you want something more flexible, take "flex" DMB.

And the board foot
##############
# board foot #
##############
     :
     :
<HR>
<P ALIGN=RIGHT>
<A HREF="http://www.visitware.com/sobaya/">
DoubleMessageBoard</A><BR>
is visitware, get it for free!
</BODY>
</HTML>
for setup.cgi and bbs.cgi. (bbs.cgi has this HTML fragment under ### board foot ### of # add to bbs #.)
Please do not remove DoubleMessageBoard logo and link.

Setup page to modify board
And the page a board master modifys the appearance of the board.
############################
# modify the board (input) #
############################
     :
     :
### modify board ###
     :
     :
<HTML>
<HEAD>
<TITLE>modify your board</TITLE>
</HEAD>
<BODY>
<BR><FONT SIZE=5>
Your directory must be<BR>
$basurl$udir<BR>
You can rearrange your message-board hereunder.
<P>
</FONT>
<FORM ACTION="$setup" method="POST">
<INPUT TYPE="hidden" NAME="name" VALUE="$data{'name'}">
<INPUT TYPE="hidden" NAME="pswd" VALUE="$data{'pswd'}">
<INPUT TYPE="hidden" NAME="do" VALUE="ify">
<TABLE BORDER><TR><TD>
&lt;HTML><BR>
&lt;HEAD><BR>
<TEXTAREA NAME="two" cols=80 rows=12>$two</TEXTAREA><BR>
ETC.
</TD></TR></TABLE>
<P>
<INPUT TYPE="submit" NAME="submit" VALUE="modify the board">
<INPUT TYPE="reset" VALUE="reset">
</FORM>
</BODY>
</HTML>
setup.cgi only.
$two represents the part of the message board HTML (aforementioned \t to \t) to be modified by the board master.

Board-is-modified page
And the greeting page when the board is remodeled.
#############################
# modify the board (output) #
#############################
     :
     :
### modified ###
     :
     :
<HTML>
<HEAD>
<TITLE>Refurbished :-)</TITLE>
</HEAD>
<BODY>
<BR><FONT SIZE=6>
Dear $data{'name'},
</FONT><BR><FONT SIZE=5>
Your board have been modified.<BR>
It is <A HREF="$basurl$udir/$ifile">HERE</A>.<BR>
Please check if everything is OK.
</FONT>
</BODY>
</HTML>
setup.cgi only.

Again HTTP header has REFRESH: $Interv;URL=$basurl$udir/$ifile. As explained before, $Interv sets how long a board master sees "Refurbished" message. $ifile (index.html by default) is where the user will be transferred after he modifies the message-board. You may send him any other web site by rewriting URL value or you delete "REFRESH" line and he does not go anywhere from the refurbished page.

Board-is-deleted page
Thank you message after the message-board is deleted can be changed too.
####################
# delete old board #
####################
     :
     :
### thank you message ###
     :
     :
<HTML>
<HEAD>
<TITLE>Thank you :-)</TITLE>
</HEAD>
<BODY>
<BR><FONT SIZE=6>
Dear $name,
</FONT><BR><FONT SIZE=5>
Your board have been deleted.<BR>
Good-by and good luck.</FONT><BR>
(You may look at what others have on their board.)
</BODY>
</HTML>
setup.cgi only.

HTTP header has "REFRESH" here too.

Error-message page
And the error message when something went wrong.
#####################
# Error No1 message #
#####################
     :
     :
<HTML>
<HEAD>
<TITLE>Error!</TITLE>
</HEAD>
<BODY>
<BR>
<B>Administrative Notice,</B>
<P>
Your command has been averted due :
<BR>$_[0]
<BR>$_[1]
<BR>$_[2]
<BR>$_[3]
<P>
You may contact to <A HREF="MAILTO:$addrss">$admin</A>
</BODY>
</HTML>
setup.cgi and bbs.cgi (at the bottom of the script).
Do not change "$_[0]" to "$_[3]" unless you understand them. They are standard error messages such as $erro0 or $erro1 defined in the basic setting at the very top of CGIs and "$!", the perl's own error message and the line number where error takes place.

Bord-master-manages-board start
A board master needs to login the administrative page to manage his message-board.
#####################
# admin page starts #
#####################
     :
     :
<HTML>
<HEAD>
<TITLE>Webmaster login</TITLE>
</HEAD>
<BODY>
<CENTER>
<FONT SIZE=6>This is the webmasters' administrative page.</FONT>
<P><FONT SIZE=5>If you are here by mistake, you may feel free to</FONT>
<BR><FONT SIZE=6><A HREF="$basurl$ifile">click here</A></FONT>
<BR><FONT SIZE=5>and see the list of our DoubleMessageBoards.</FONT>
<HR>
No member, no entry hereunder.
</CENTER>
<FORM ACTION="$bbs" method="POST">
<TABLE>
<TR>
<TD><B>Your ID:</B></TD><TD><INPUT TYPE="text" NAME="name"></TD>
</TR><TR>
<TD><B>Password:</B></TD><TD><INPUT TYPE="password" NAME="pswd"></TD>
</TR>
</TABLE>
<INPUT TYPE="hidden" NAME="do" VALUE="login">
<INPUT TYPE="submit" NAME="submit" VALUE="Webmaster Login">
<INPUT TYPE="reset" VALUE="reset">
</FORM>
</BODY>
</HTML>
bbs.cgi only.
This is a form sending ID and password.

Way guest's article looks
And the most important HTML piece, the form a guest's article is arranged.
#################
# add new entry #
#################
     :
     :
### new data ###
     :
<hr>
<b>$data{'name'}</b> <small>($posted)</small><p>
<b>$data{'title'}</b><br>$data{'comments'}
bbs.cgi only.
This is how guests' comments are arranged and put on the message-board. You can rearrange them. But do not change what start with "$", $data{'name'} for the guest's name, $posted for the time the article is posted, $data{'title'} for the title of the article and $data{'comments'} for the body of the message. If the spellings are changed, perl can not recognize proper items.

When an article is too long, a daughterboard is made to accommodate all of what a guest wants to say.
#######################
# daughterboard entry #
#######################
     :
     :
<HTML>
<HEAD>
<TITLE>DaughterBoard</TITLE>
</HEAD>
<BODY BGCOLOR="lightblue">
$data{'comments'}
<P>
<B>use browser's Back button to return to the MotherBoard.</B>
</BODY>
</HTML>
bbs.cgi only.

And a link from motherboard is made, that can be changed too.
#######################
# daughterboard entry #
#######################
     :
     :
$data{'comments'}<p><a href="$time.html"><i>$cutoff more byte(s), click here!</i></a>";
bbs.cgi only.
<a href="$time.html"> . . </a> is the link to the daughterboard. It is placed between $data{'comments'} = <<"DTR_LINK"; and DTR_LINK.

Thank you page
And another thank you message.
#####################
# thank you message #
#####################
     :
     :
<HTML>
<HEAD>
<TITLE>Thank you :-)</TITLE>
</HEAD>
<BODY>
<BR><FONT SIZE=6>
Dear $data{'name'},
</FONT><BR><FONT SIZE=5>
$msg<BR>
Now, you will be back to the MessageBoard.
</FONT>
</BODY>
</HTML>
bbs.cgi only.
This message is used both for a guest posting comments and the board master completing the administrative work. For a guest, $togst replaces $msg. For the board master, $forbm replaces $msg. Both $togst and $forbm are set at the top of cgi, "basic set up".

The HTTP header has "REFRESH" here also.

Board-master-deletes-articles page
Upon the login, a board master can review and delete unwanted articles from the board. The all operation can be done on the web. FTP is not necessary. The following editing page can be found far below in the cgi.
#####################
# editor page login #
#####################
     :
     :
The lock file <B>$tfile</B> has been created $old minutes ago.
Somebody may be writing on Board.
Or you may interrupt the operation last time.
     :
     :
### editor page head ###
     :
     :
<HTML>
<HEAD>
<TITLE>Webmaster Only!</TITLE>
</HEAD>
<BODY>
<CENTER>
<FONT SIZE=6>This is the webmaster's administrative page.</FONT>
<BR>If you are here to hack the site, please don't.
<SMALL><P>And if you can inform <A HREF="MAILTO:$addrss">the administrator</A> any security hole you've found,
<BR>I am deeply grateful to you for your kindness
<BR>(and having good skills but not abusing them).<P></SMALL>
Thank you!
</CENTER>
<HR>$warn
<H2>Articles to be reviewed.</H2>
<FORM ACTION="$bbs" method="POST">
     :
     :
### editor page body ###
     :
     :
$dataf<P><INPUT TYPE="checkbox" NAME="$i"> check to DELETE<P>
     :
     :
### editor page foot ###
     :
     :
<HR>
<INPUT TYPE="hidden" NAME="do" VALUE="delete">
<INPUT TYPE="hidden" NAME="name" VALUE="$data{'name'}">
<INPUT TYPE="hidden" NAME="pswd" VALUE="$data{'pswd'}">
<INPUT TYPE="submit" NAME="submit" VALUE="delete checked">
<INPUT TYPE="reset" VALUE="reset">
<INPUT TYPE="submit" NAME="submit" VALUE="$dall">
<INPUT TYPE="submit" NAME="submit" VALUE="$aok">
<BR>Please note, "$dall" deletes all the articles from the data base
and the MessageBoard. If everything is ok, please click "$aok" and do not quit arbitrary.
</FORM>
</BODY>
</HTML>
bbs.cgi only.
The upper block sets the warning or $warn which can be found between $warn = <<"WARN"; and WARN above the editor page head. It may be inserted in the review page. The warning informs the board master that someone is writing on the board (usually) or he didn't completed the editorial operation last time (if he is forgetful) or an unsuccessful hacking might take place. Again, you do not change the TYPEs/NAMEs of fields nor anything start with "$".

If you are testing your CGIs before uploading them to the server, see the advice for a good HTML user.