bin/receive_test
changeset 5 0ed8b6a9da49
parent 4 4bc929b9563f
equal deleted inserted replaced
4:4bc929b9563f 5:0ed8b6a9da49
     3 use strict;
     3 use strict;
     4 use warnings;
     4 use warnings;
     5 use CGI;
     5 use CGI;
     6 use CGI::Carp qw(fatalsToBrowser);
     6 use CGI::Carp qw(fatalsToBrowser);
     7 
     7 
     8 my ($Daten, $value,$name, $text,$anhang,$input,$q,$key,$wert,$param,%result);
     8 my (
     9 my $i=0;
     9     $Daten, $value, $name, $text,  $anhang, $input,
       
    10     $q,     $key,   $wert, $param, %result
       
    11 );
       
    12 my $i = 0;
    10 my %Formular;
    13 my %Formular;
    11 my @Formularfelder;
    14 my @Formularfelder;
    12 
    15 
       
    16 $anhang = $ENV{'QUERY_STRING'};
       
    17 read( STDIN, $Daten, $ENV{'CONTENT_LENGTH'} );
       
    18 print $Daten;
       
    19 &verarbeiten;
    13 
    20 
    14 $anhang= $ENV{'QUERY_STRING'};
       
    15 read(STDIN, $Daten, $ENV{'CONTENT_LENGTH'});
       
    16 &verarbeiten;
       
    17 sub verarbeiten {
    21 sub verarbeiten {
    18 @Formularfelder = split(/&/, $Daten);
    22     @Formularfelder = split( /&/, $Daten );
    19 foreach my $Feld (@Formularfelder) {
    23     foreach my $Feld (@Formularfelder) {
    20   ($name, $value) = split(/=/, $Feld);
    24         ( $name, $value ) = split( /=/, $Feld );
    21   $value =~ tr/+/ /;
    25         $value =~ tr/+/ /;
    22   $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    26         $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    23   $Formular{$name} = $value;
    27         $Formular{$name} = $value;
    24  }
    28     }
    25 }
    29 }
    26 my @schluessel=keys(%Formular);
    30 my @schluessel = keys(%Formular);
    27 @schluessel=reverse @schluessel;
    31 @schluessel = reverse @schluessel;
    28 my @values=values(%Formular);
    32 my @values = values(%Formular);
    29 @values=reverse @values;
    33 @values = reverse @values;
    30 open (OUT,">test");
    34 
    31 print OUT ("\@schluessel: @schluessel\n\@values: @values\n");
    35 # Folgend Test-Script
    32 close OUT;
    36 
    33 # Folgend SSL-Script
    37  
    34 
    38 
    35 # Test
    39 # Test
    36 my $x=0;
    40 my $x = 0;
    37 open (OUT,">/var/www/index.html");
    41 open( OUT, ">/var/www/index.html" );
    38 print OUT ('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"><head>
    42 print OUT (
    39 <title>CGI-Feedback</title><body><h1>CGI-Feedback vom Programm  <i>recieve</i></h1>');
    43 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"><head>
    40 foreach (@schluessel){
    44 <title>CGI-Feedback</title><body><h1>CGI-Feedback vom Programm  <i>recieve</i></h1>'
    41 print OUT ('<p><B>Feldname: </B>'.$schluessel[$x].' <B> Inhalt: </B>'.$values[$x].'<br>');
    45 );
    42 $x++;
    46 foreach (@schluessel) {
       
    47     print OUT ( '<p><B>Feldname: </B>'
       
    48           . $schluessel[$x]
       
    49           . ' <B> Inhalt: </B>'
       
    50           . $values[$x]
       
    51           . '<br>' );
       
    52     $x++;
    43 }
    53 }
    44 print OUT ('</body></html>');
    54 print OUT ('</body></html>');
    45 close OUT;
    55 close OUT;