--- a/htdocs/cgi-bin/receive Tue Feb 05 08:05:54 2013 +0100
+++ b/htdocs/cgi-bin/receive Tue Feb 05 14:01:36 2013 +0100
@@ -4,6 +4,7 @@
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
+use Net::SCP;
my (
$Daten, $value, $name, $text, $anhang, $input,
@@ -12,7 +13,6 @@
my %Formular;
my @Formularfelder;
-#$anhang = $ENV{'QUERY_STRING'};
read( STDIN, $Daten, $ENV{'CONTENT_LENGTH'} );
print $Daten;
&verarbeiten;
@@ -21,9 +21,12 @@
@Formularfelder = split( /&/, $Daten );
foreach my $Feld (@Formularfelder) {
( $name, $value ) = split( /=/, $Feld );
- $value=~ s/\<26\>/&/;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
+ $value =~ s/\<3D\>/\=/g;
+ $value =~ s/\<25\>/\%/g;
+ $value =~ s/\<2B\>/\+/g;
+ $value =~ s/\<26\>/\&/g;
$Formular{$name} = $value;
}
}
@@ -37,15 +40,29 @@
# Folgend Test-Script
-open OUT,">test";
-print OUT "\@schluessel: @schluessel\n\@werte: @values\n\n";
-print OUT $Daten;
+if ($Formular{req} ne ''){
+ open (OUT, ">$uid.pem");
+ print OUT "$Formular{req}";
+ close OUT;
+}
+
+open OUT,">$uid";
+print OUT "\@schluessel:\t=\t\@werte:\n";
+print OUT "------------\t\t-------\n\n";
+for(my $x=0;$x<=$#schluessel;$x++){
+print OUT "$schluessel[$x]\t\t=\t$values[$x]\n";
+}
close OUT;
+my $scp=Net::SCP->new();
+$scp->scp($uid,'root@192.168.0.138:/var/www/download/');
+system ("rm $uid");
+system ("rm $uid.pem");
+__END__
+
# Test
-$uid=$uid.'.html';
my $x=0;
-open( OUT, ">/var/www/$uid" );
+open( OUT, ">/var/www/$uid.html" );
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>
<title>CGI-Feedback</title><body><h1>CGI-Feedback vom Programm <i>recieve</i></h1>'
@@ -60,6 +77,3 @@
}
print OUT ('</body></html>');
close OUT;
-sleep(180);
-system "rm /var/www/$uid";
-__END__