home *** CD-ROM | disk | FTP | other *** search
-
- print "Content-type: text/html\n\n";
- #
- # This reads in the information sent when the user pressed Submit
- #
- if ($ENV{'REQUEST_METHOD'} eq "GET") { $buffer = $ENV{'QUERY_STRING'}; }
- else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); }
-
- #
- # Now, using a little loop, we'll split up the data into name/value
- # pairs, which makes them easier to work with.
- #
- @pairs = split(/&/, $buffer);
- foreach $pair (@pairs)
- {
- ($name, $value) = split(/=/, $pair);
-
- $value =~ tr/+/ /;
- $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
-
- $FORM{$name} = $value;
- }
-
-
- &processFile;
- &success;
-
- exit;
-
-
- #######################################################################
- ############################ Add to data file #######################
- #######################################################################
-
-
- sub processFile {
-
- unlink <../message/*.html>;
-
- open(original,"../message/bbs-data.original") || die "can't open bbs-data.original\n";
- open(ind,">> ../message/bbs-data.html") || die "can't open bbs-data.original\n";
- &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 zero.counter\n";
- open(ind, "> ../message/thread_counter") || die "can't open thread_counter\n";
- &lock(ind);
- select(ind);
- while(<original>){
- print;
- }
- &unlock(ind);
- close(original);
- close(ind);
-
- open(original,"../message/zero.counter") || die "can't open zero.counter\n";
- open(ind, "> ../message/counter") || die "can't open thread_counter\n";
- &lock(ind);
- select(ind);
- while(<original>){
- print;
- }
- &unlock(ind);
- close(original);
- close(ind);
-
- }
-
-
-
- sub lock{
- if ($flock_exists == 1){
- local ($file_handle);
- foreach $file_handle (@_){
- flock($file_handle, 2);
- }
- }
- }
-
-
- sub unlock{
- if ($flock_exists == 1){
- local ($file_handle);
- foreach $file_handle (@_){
- flock($file_handle, 8);
- }
- }
- }
-
-
-
-
-
- ###############################################################################
- ############################ Complete/Success ###############################
- ###############################################################################
- sub success{
- select(STDOUT);
- open(EP,"$SUCCESS");
- print "<html><head>Web Forum have been reseted</head><h3>The message area of the Web Forum have been completely reseted.</h3>";
-
- close(EP);
- exit;
-
- ##### chmod
-
-
-
- }
-
-
- ###############################################################################
- ############################ Incomplete Error ###############################
- ###############################################################################
- sub notcomplete {
- select(STDOUT);
- open(EP,"$ERROR");
- while(<EP>){
- print "$_";
- }
- close(EP);
- exit;
- }
-
- ###############################################################################
- ############################ Invalid char ###############################
- ###############################################################################
- sub invalidchar {
- select(STDOUT);
- open(EP,"$ERROR_CHAR");
- while(<EP>){
- print "$_";
- }
- close(EP);
- exit;
- }
-
-
-
-
-
-
-