home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1998 October A
/
Pcwk10a98.iso
/
Lotus
/
NETOBJ
/
T2.Z
/
bbs_components.sit
/
submit-bbs-form.cgi.rsrc
/
TEXT_128_!.txt
< prev
next >
Wrap
Text File
|
1997-04-08
|
10KB
|
344 lines
##################################
###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(<original>){
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(<original>){
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(<original>){
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 (<TOKEN>) {
$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";
<HTML><HEAD>
<TITLE>bbs submit</TITLE><META NAME="Author" CONTENT="">
<script language="JavaScript">
<!--
var today = new Date();
function newCookie(name, value){
document.cookie = name + "=" + value + "; expires=Tue, 07 Jan 2010 00:00:01 GMT";
}
function readCookie(name){
var cookieFound = false;
var start = 0;
var end = 0;
var cookieString = document.cookie;
var i = 0;
while (i <= cookieString.length){
start =i;
end = start + name.length;
if (cookieString.substring(start,end) == name){
cookieFound = true;
break;
}
i++;
}
if (cookieFound){
start = end + 1;
end = document.cookie.indexOf(";",start);
if (end < 0){
end = document.cookie.length;
}
else if (end < start){
end = document.cookie.length;
}
return document.cookie.substring(start,end);
}
return '';
}
function replace(target,oldTerm,newTerm,caseSens,wordOnly){
var work=target;
var ind=0;
var next=0;
if(!caseSens){
oldterm = oldTerm.toLowerCase();
work = target.toLowerCase();
}
while((ind = work.indexOf(oldTerm,next)) >= 0) {
if (wordOnly){
var before = ind - 1;
var after = ind + oldTerm.length;
if (!(space(work.charAt(before)) && space(work.charAt(after)))){
next = ind + oldTerm.length;
continue;
}
}
target = target.substring(0,ind) + newTerm + target.substring(ind+oldTerm.length,target.length);
work = work.substring(0,ind) + newTerm + work.substring(ind+oldTerm.length,work.length);
next = ind + newTerm.length;
if (next >= work.length) { break; }
}
return target;
}
function timeNow(){
return today.getTime();
}
function timeRealNow(){
return replace(today.toGMTString()," ","_",false,false);
}
//-->
</script>
</HEAD>
<BODY bgcolor=#FFFFFF LINK=#FF0000 VLINK=#800080 ALINK=#800080>
END
$printme = getToken();
if ($PARENT == 0){
print "<font size=4>Reply to Message: $printme</font>";
}
else {
print "<font size=4>New Message: $printme</font>";
}
print<<"END";
<FORM ACTION="bbs-submit.cgi" method="post">
END
print "<INPUT TYPE=HIDDEN NAME=\"parent\" VALUE= \"$PARENT\">";
print "<INPUT TYPE=HIDDEN NAME=\"thread\" VALUE = \"$printme\">";
print <<"END";
<script language="JavaScript">
document.write("<INPUT TYPE=HIDDEN NAME=time VALUE =\\""+timeNow()+"\\">");
document.write("<INPUT TYPE=HIDDEN NAME=RealTime VALUE ="+timeRealNow()+">");
</script>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=485>
<TR>
<TD WIDTH=12></TD><TD WIDTH=25></TD><TD WIDTH=38></TD><TD WIDTH=13></TD><TD WIDTH=91></TD>
<TD WIDTH=3></TD><TD WIDTH=92></TD><TD WIDTH=54></TD><TD WIDTH=157></TD><TD WIDTH=0></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=10 HEIGHT=36></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=4></TD>
<TD COLSPAN=4 ROWSPAN=3 WIDTH=240>
<script language="JavaScript">
document.write('<INPUT TYPE=text NAME=\\"name\\" SIZE=\\"30\\" MAXLENGTH=\\"100\\" onChange=\\"newCookie(\\'netobjects_bbs_username\\',this.form.name.value)\\" VALUE=\\"' + readCookie("netobjects_bbs_username")+ '\\">');
</script>
</TD>
<TD COLSPAN=2 HEIGHT=3></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=2></TD>
<TD COLSPAN=1 ROWSPAN=1 WIDTH=38>
<P ALIGN="RIGHT"><B>Name</B></TD>
<TD COLSPAN=1></TD>
<TD COLSPAN=2 HEIGHT=16></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=4></TD>
<TD COLSPAN=2 HEIGHT=3></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=10 HEIGHT=11></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=4></TD>
<TD COLSPAN=4 ROWSPAN=3 WIDTH=240>
<script language=JavaScript>
document.write('<INPUT TYPE=text NAME=\\"email\\" SIZE=\\"30\\" MAXLENGTH=\\"100\\" onChange=\\"newCookie(\\'netobject_bbs_email\\',this.form.email.value)\\" VALUE=\\"'+readCookie("netobject_bbs_email")+ '\\">');
</script>
</TD>
<TD COLSPAN=2 HEIGHT=1></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=2></TD>
<TD COLSPAN=1 ROWSPAN=1 WIDTH=38>
<P ALIGN="RIGHT"><B>E-mail</B></TD>
<TD COLSPAN=1></TD>
<TD COLSPAN=2 HEIGHT=16></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=4></TD>
<TD COLSPAN=2 HEIGHT=5></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=10 HEIGHT=13></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=4></TD>
<TD COLSPAN=4 ROWSPAN=3 WIDTH=240>
<script language="JavaScript">
document.write('<INPUT TYPE=text NAME=\\"subject\\" SIZE=\\"30\\" MAXLENGTH=\\"100\\" VALUE=\\"' + parent.getParentSubject("$printme")+ '\\">');
</script>
</TD>
<TD COLSPAN=2 HEIGHT=2></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=1></TD>
<TD COLSPAN=2 ROWSPAN=1 WIDTH=63>
<P ALIGN="RIGHT"><B>Subject</B></TD>
<TD COLSPAN=1></TD>
<TD COLSPAN=2 HEIGHT=18></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=4></TD>
<TD COLSPAN=2 HEIGHT=2></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=10 HEIGHT=8></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=4></TD>
<TD COLSPAN=5 ROWSPAN=1 WIDTH=397><TEXTAREA NAME="body" ROWS=10 COLS=48 ></TEXTAREA></TD>
<TD COLSPAN=1 HEIGHT=179></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=10 HEIGHT=6></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=6></TD>
<TD COLSPAN=1 ROWSPAN=2 WIDTH=92 ALIGN="center" VALIGN="center"></TD>
<TD COLSPAN=3 HEIGHT=1></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=4></TD>
<TD COLSPAN=1 ROWSPAN=1 WIDTH=92 ALIGN="center" VALIGN="center"><INPUT TYPE=SUBMIT VALUE="Submit"></TD>
<TD COLSPAN=1></TD>
<TD COLSPAN=3 HEIGHT=22></TD>
</TR>
<TR VALIGN="top" ALIGN="left">
<TD COLSPAN=10 HEIGHT=0></TD>
</TR>
</TABLE>
</FORM></BODY>
</HTML>
END