home *** CD-ROM | disk | FTP | other *** search
-
- #The database separator token is --
-
- $TOKEN =" ";
- ###################
- ###################
- ###################
-
- #This will allow error to pump directly to to client, instead of crashing the server.
- select STDOUT;
- 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.
- #
- $buffer =~ s/([;<>\*\|`&\$!\#\(\)\[\]\{\}:'"])/\\$1/g;
- $buffer =~ tr/\n//d;
- $buffer = "$buffer ";
-
- @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;
- chop($value);
- if ($FORM{$name} eq '') {$FORM{$name} = $value;}
- else {$FORM{$name} = "$FORM{$name} $value";}
- }
-
-
- # Once the name/value pairs have been created, you can work with
- # them by referring to the variable names you set up in the
- # original HTML, using $FORM{"varname"}.
-
- # First, we make sure that they actually gave an email address
- #
- #check for error -- REQUIRE on selective basis $FORM{'na'}
-
- ¬completeinternal unless $FORM{'fields'} && $FORM{'filename'} && $FORM{'error'} && $FORM{'success'};
-
- $STORAGEFILE = $FORM{'filename'};
- $NUMBERARG = $FORM{'fields'};
-
- $COUNTER = 1;
-
-
- #### Auto #####
- $ERRORRESPONSE=$FORM{'error'};
- $SUCCESSRESPONSE=$FORM{'success'};
- $STORAGE = $STORAGEDIR.$STORAGEFILE;
- $ENV{'HTTP_REFERER'} =~ s/\/[^\/]*$/\//g;
-
- while($COUNTER <= $NUMBERARG){
- $CONFIG = $COUNTER.a;
- ¬complete if (($FORM{$COUNTER} eq '') && ($FORM{$CONFIG} eq "TRUE"));
- $COUNTER = $COUNTER + 1;
- }
-
- &makedat;
- &success;
- exit;
-
-
- ######################################################################
- ############################ Make .dat file ######################
- ######################################################################
- sub makedat {
- open(NEW,">> $STORAGE") || &permissionfail;
- select(NEW);
- $COUNTER = 1;
- $DATA = $FORM{$COUNTER};
- $DATA =~ s/\r\n/" "/eg;
- print NEW "$DATA";
- $COUNTER = 2;
- while($COUNTER <= $NUMBERARG){
- $DATA = $FORM{$COUNTER};
- $DATA =~ s/\r\n/" "/eg;
- print NEW "$TOKEN$DATA";
- $COUNTER = $COUNTER + 1;
- }
- print NEW "\n";
- close(NEW);
- }
- ###############################################################################
- ############################ Complete/Success ###############################
- ###############################################################################
- sub success{
- select(STDOUT);
- print "<html>";
- print "<head>";
- print "<meta http-equiv=\"Refresh\" content=\"0; URL=$SUCCESSRESPONSE\">";
- print "</head>";
- print "</html>";
-
- }
-
- ###############################################################################
- ############################ Incomplete Error ###############################
- ###############################################################################
- sub notcomplete {
- select(STDOUT);
- print "<html>";
- print "<head>";
- print "<meta http-equiv=\"Refresh\" content=\"0; URL=$ERRORRESPONSE\">";
- print "</head>";
- print "</html>";
- exit;
- }
-
- ###############################################################################
- ############################ Incomplete Error ###############################
- ###############################################################################
- sub notcompleteinternal {
- select(STDOUT);
- print "<html>";
- print "<h3>This is a internal error (without configuration variable)</h3>";
- print "the following variable are escape out for perl script protection:";
- print "<UL>";
- print "\;<>\*\|\`\&\$\!\#()[]{}\:\'\"\/ (return character deleted)<br>";
- print "</UL>";
- print "or one of the following file is not declare in the field:";
- print "<UL>";
- print "filename (date file name)<br>";
- print "fields (# of field)<br>";
- print "success(success respond file) <br> ";
- print "error(error respond file) <br>";
- print "</UL>";
- print "</html>";
- exit;
- }
-
- sub permissionfail {
- select(STDOUT);
- print "<html>";
- print "<h3>Error writing to data file.</h3>";
- print "There was an error trying to access the data file.<br>";
- print "This CGI may not have permission to write to this file.<br>";
- print "Please contact the system administrator.<br>";
- print "The data entered in the form was not recorded due to this problem.<br>";
- print "</html>";
- exit;
- }
-
-
-
-
-
-
-
-
-
-
-