#!/usr/local/bin/perl
################
|
Simple optional changes
You may make optional changes
################
# basic set up # ################ : : $maxle = 512; $maxno = 50; $Interv = 3; $lfexp = 1/48; |
where
$maxle = 512; |
$maxno = 50; |
$Interv = 3; |
$lfexp = 1/48; |
Others in "basic set up" set few wording. (take little notices of discrepancy between bbs.cgi and setup.cgi)
$dname = "Guest";
$dttle = "Untitled"; |
$dall = "Delete all";
$aok = "All OK"; |
$admin = "administrator"; |
$togst = "Your comments have been successfully added.";
$forbm = "The operation has been completed."; |
$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> |
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 |
print <<"YOUR_HTML_DOC";
: : You have HTML here. : : YOUR_HTML_DOC : : HTML continues. : : YOUR_HTML_DOC |
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>
|
############################
# modify the board (input) # ############################ : : ### modify board ### print <<"NEW_BOARD"; Cache-Control: no-cache Pragma: no-cache Content-type: text/html |
#####################
# admin page starts # ##################### : : print <<"ADMIN_PAGE"; Cache-Control: no-cache Pragma: no-cache Content-type: text/html |
#####################
# editor page login # ##################### : : ### editor page head ### print <<"HTML_HEAD"; Cache-Control: no-cache Pragma: no-cache Content-type: text/html |
<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> |
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> |
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 |
(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> |
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> |
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> <HTML><BR> <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> |
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> |
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> |
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> |
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> |
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'} |
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> |
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>"; |
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> |
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> |
If you are testing your CGIs before uploading them to the server, see the advice for a good HTML user.