1 #!/usr/bin/perl |
|
2 |
|
3 use strict; |
|
4 use warnings; |
|
5 use CGI; |
|
6 use CGI::Carp qw(fatalsToBrowser); |
|
7 |
|
8 my ( |
|
9 $Daten, $value, $name, $text, $anhang, $input, |
|
10 $q, $key, $wert, $param, %result |
|
11 ); |
|
12 my $i = 0; |
|
13 my %Formular; |
|
14 my @Formularfelder; |
|
15 |
|
16 $anhang = $ENV{'QUERY_STRING'}; |
|
17 read( STDIN, $Daten, $ENV{'CONTENT_LENGTH'} ); |
|
18 print $Daten; |
|
19 &verarbeiten; |
|
20 |
|
21 sub verarbeiten { |
|
22 @Formularfelder = split( /&/, $Daten ); |
|
23 foreach my $Feld (@Formularfelder) { |
|
24 ( $name, $value ) = split( /=/, $Feld ); |
|
25 $value =~ tr/+/ /; |
|
26 $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; |
|
27 $Formular{$name} = $value; |
|
28 } |
|
29 } |
|
30 my @schluessel = keys(%Formular); |
|
31 @schluessel = reverse @schluessel; |
|
32 my @values = values(%Formular); |
|
33 @values = reverse @values; |
|
34 |
|
35 # Folgend Test-Script |
|
36 |
|
37 |
|
38 |
|
39 # Test |
|
40 my $x = 0; |
|
41 open( OUT, ">/var/www/index.html" ); |
|
42 print OUT ( |
|
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> |
|
44 <title>CGI-Feedback</title><body><h1>CGI-Feedback vom Programm <i>recieve</i></h1>' |
|
45 ); |
|
46 foreach (@schluessel) { |
|
47 print OUT ( '<p><B>Feldname: </B>' |
|
48 . $schluessel[$x] |
|
49 . ' <B> Inhalt: </B>' |
|
50 . $values[$x] |
|
51 . '<br>' ); |
|
52 $x++; |
|
53 } |
|
54 print OUT ('</body></html>'); |
|
55 close OUT; |
|