################################## ###CONFIGURATION################## ################################## ################################## ###FULL URL of BBS################ ################################## $BBS_HOME='::'; ################################## ###DISPLAY DIRECTORY############## ################################## $HTML_DIR='::html'; $ERROR='error.html'; $ERROR_CHAR='error-char.html'; $SUCCESS='success.html'; ################################### ###STORAGE DIRECTORY############### ################################### # This directory should be "server" readable/writeable/executable only. $STORAGE_DIR='::message'; # The files below should be world readable/writable only. $ERROR_COLLECT='error-collect.txt'; $SUCCESS_COLLECT='bbs-data.html'; $TOKEN_FILE ='counter'; $THREAD_TOKEN ='thread_counter'; # if your system does not support the flock() function, comment this out, or set it to 0. # the latest edition of NT Perl, as well as all unix perl should have flock build in. $flock_exists = 1; ################################## ### END OF CONFIGURATION ######### ################################## ### APPEND DIRECTORY with FILE ### ################################## $ERROR = $HTML_DIR.':'.$ERROR; $ERROR_CHAR = $HTML_DIR.':'.$ERROR_CHAR; $SUCCESS = $HTML_DIR.':'.$SUCCESS; $TMP = $STORAGE_DIR.':'.($$).".tmp"; $ERROR_COLLECT = $STORAGE_DIR.':'.$ERROR_COLLECT; $INDEX_FILE = $STORAGE_DIR.':'.$SUCCESS_COLLECT; $TOKEN_FILE = $STORAGE_DIR.':'.$TOKEN_FILE; $THREAD_TOKEN = $STORAGE_DIR.':'.$THREAD_TOKEN; ################################### $PARENT=1; sub lock{ } sub unlock{ } sub createInd{ open(original,"::message:bbs-data.original") || die "can't open bbs-data.original "; open(ind,">> ::message:bbs-data.html") || die "can't open bbs-data.original "; &lock(ind); select(ind); while(){ print; } &unlock(ind); close(original); close(ind); chmod 0606, <::message:bbs-data.html>; open(original,"::message:zero.counter") || die "can't open bbs-data.original "; open(ind,">> ::message:counter") || die "can't open bbs-data.original "; &lock(ind); select(ind); while(){ print; } &unlock(ind); close(original); close(ind); chmod 0606, <::message:counter>; open(original,"::message:zero.counter") || die "can't open bbs-data.original "; open(ind,">> ::message:thread_counter") || die "can't open bbs-data.original "; &lock(ind); select(ind); while(){ print; } &unlock(ind); close(original); close(ind); chmod 0606, <::message:thread_counter>; } sub getToken{ createInd unless (-e "::message:bbs-data.html"); if ($ENV{'QUERY_STRING'} != ''){ $PARENT=0; return ($ENV{'QUERY_STRING'}); } open(TOKEN,"$THREAD_TOKEN") || die "can't open $STORAGE_DIR:$file_handle.html\n"; &lock(TOKEN); while () { $tokenReturn = "$_"; chop($tokenReturn); } &unlock(TOKEN); close(TOKEN); open(TOKEN,"> $THREAD_TOKEN") || die "can't open $STORAGE_DIR:$file_handle.html\n"; &lock(TOKEN); $tokenNext = $tokenReturn + 1; select(TOKEN); print <<"DONE"; $tokenNext DONE &unlock(TOKEN); close(TOKEN); select(STDOUT); return $tokenReturn; } select(STDOUT); print "Content-type: text/html\n\n"; print <<"END"; bbs submit END $printme = getToken(); if ($PARENT == 0){ print "Reply to Message: $printme"; } else { print "New Message: $printme"; } print<<"END";
END print ""; print ""; print <<"END";

Name

E-mail

Subject

END