|
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, $uid |
|
11 ); |
|
12 my %Formular; |
|
13 my @Formularfelder; |
|
14 |
|
15 #$anhang = $ENV{'QUERY_STRING'}; |
|
16 read( STDIN, $Daten, $ENV{'CONTENT_LENGTH'} ); |
|
17 print $Daten; |
|
18 &verarbeiten; |
|
19 |
|
20 sub verarbeiten { |
|
21 @Formularfelder = split( /&/, $Daten ); |
|
22 foreach my $Feld (@Formularfelder) { |
|
23 ( $name, $value ) = split( /=/, $Feld ); |
|
24 $value=~ s/\<26\>/&/; |
|
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 $uid=$Formular{ID}; |
|
31 chomp$uid; |
|
32 my @test=$Formular{req}; |
|
33 my @schluessel = keys(%Formular); |
|
34 @schluessel = reverse @schluessel; |
|
35 my @values = values(%Formular); |
|
36 @values = reverse @values; |
|
37 |
|
38 # Folgend Test-Script |
|
39 |
|
40 open OUT,">test"; |
|
41 print OUT "\@schluessel: @schluessel\n\@werte: @values\n\n"; |
|
42 print OUT $Daten; |
|
43 close OUT; |
|
44 |
|
45 # Test |
|
46 $uid=$uid.'.html'; |
|
47 my $x=0; |
|
48 open( OUT, ">/var/www/$uid" ); |
|
49 print OUT ( |
|
50 '<!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> |
|
51 <title>CGI-Feedback</title><body><h1>CGI-Feedback vom Programm <i>recieve</i></h1>' |
|
52 ); |
|
53 foreach (@schluessel) { |
|
54 print OUT ( '<p><B>Feldname: </B>' |
|
55 . $schluessel[$x] |
|
56 . ' <B> Inhalt: </B>' |
|
57 . $values[$x] |
|
58 . '<br>' ); |
|
59 $x++; |
|
60 } |
|
61 print OUT ('</body></html>'); |
|
62 close OUT; |
|
63 sleep(180); |
|
64 system "rm /var/www/$uid"; |
|
65 __END__ |