--- a/htdocs/cgi-bin/send_n Tue Feb 05 08:05:54 2013 +0100
+++ b/htdocs/cgi-bin/send_n Tue Feb 05 14:01:36 2013 +0100
@@ -5,10 +5,11 @@
use LWP::UserAgent;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
+use Net::SCP;
my (
- @feld, $uid, $cgi, $feld, $feld4, $feld1, $feld2,
- $feld3, $get, $url, $ua, $ub, $req
+ $uid, $cgi, $feld, $feld4, $feld1, $feld2,
+ $feld3, $get, $url, $ua, $ub, $req
);
my $x = 1;
$uid = `uuidgen`;
@@ -21,8 +22,8 @@
# des Web-Formulars #
#######################
-$feld1 = $cgi->param('Firma'); # FIXED
-$feld2 = $cgi->param('Name');
+$feld1 = $cgi->param('Firma');
+$feld2 = $cgi->param('Mail');
$feld3 = $cgi->param('Test');
$feld4 = $cgi->param('req');
$feld1 =~ s/\&/\<26\>/g;
@@ -64,45 +65,29 @@
$ua->request($req);
open( HTML1, ">/var/www/$uid" . "1.html" );
-print HTML1 (
-'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>Download</title></head><body><p>Klicken Sie bitte auf den Link um ihre Datei zu Downloaden oder anzuzeigen.<br>Zum Speichern des Inhaltes klicken Sie den Link mit der rechten Maustaste an und wählen "Ziel speichern unter..."</p><p><a href="/download/'
- . $uid
- . '" type="application/octet-stream">Test</a></p></body></html>' );
+print HTML1 ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><head><title>Download</title></head><body><p>Klicken Sie bitte auf den Link um ihre Datei zu Downloaden oder anzuzeigen.<br>Zum Speichern des Inhaltes klicken Sie den Link mit der rechten Maustaste an und wählen \"Ziel speichern unter...\"</p><p><a style=\"text-decoration: none;\" href=\"/download/$uid\" type=\"application/octet-stream\">$uid</a></p ></body></html>" );
close HTML1;
open( HTML, ">/var/www/$uid.html" );
-print HTML (
-"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><head><title>Download</title><meta http_equiv=\"refresh\" content=\"10;URL=http://192.168.0.138/"
- . $uid
- . "1.html\"></head><script type=\"text/javascript\">
- <!--
- var homepage = 'http://192.168.0.138/" . $uid . "1.html';
- var sekunden = 10;
-
- function countdownWeiterleitung()
- {
- sekunden--;
- document.getElementById('counter_span').innerHTML = sekunden;
- if ( !sekunden ) {
- document.location.href = homepage;
- }
- }
-
- window.setInterval('countdownWeiterleitung()', 1000);
- //-->
-
- </script><body><p>Ihr Download steht in kürze bereit!<br>Sie werden in <span id=\"counter_span\" class=\"dd\">10</span> sekunden automatisch Weitergeleitet.<br>Sollte die automatische Weiterleitung nicht funktionieren, klicken Sie bitte <a href=\""
- . $uid
- . "1.html\">hier</a></p></body></html>"
-);
+print HTML ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><head><title>Download</title><meta http_equiv=\"refresh\" content=\"10;URL=http://192.168.0.138/". $uid . "1.html\"></head><script type=\"text/javascript\">
+<!--
+var homepage = 'http://192.168.0.138/" . $uid . "1.html';
+var sekunden = 10;
+function countdownWeiterleitung(){
+ sekunden--;
+ document.getElementById('counter_span').innerHTML = sekunden;
+ if ( !sekunden ) {
+ document.location.href = homepage;
+ }
+}
+window.setInterval('countdownWeiterleitung()', 1000);
+//-->
+</script><body><p>Ihr Download steht in kürze bereit!<br>Sie werden in <span id=\"counter_span\" class=\"dd\">10</span> sekunden automatisch Weitergeleitet.<br>Sollte die automatische Weiterleitung nicht funktionieren, klicken Sie bitte <a style=\"text-decoration: none;\" href=\"".$uid."1.html\">hier</a>.</p><p>Bitte beachten Sie, dass Ihr Download nur 5 minuten gültig ist.</p></body></html>");
-#print HTML ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><head><title>Download</title><meta http_equiv=\"refresh\" content=\"10;URL=http://192.168.0.138/$uid\1.html\"></head><script type=\"text/javascript\">function countDown(init){if (init || --document.getElementById( \"counter\" ).firstChild.nodeValue >0 )window.setTimeout(\"countDown()\",1000);};</script><body onload=\"countDown(true)\"><p>Ihr Download steht in kürze bereit!<br>Sie werden in <span id=\"counter\" class=\"dd\">10</span> sekunden automatisch Weitergeleitet.<br>Sollte die automatische Weiterleitung nicht funktionieren, klicken Sie bitte <a href=\"$uid\1.html\">hier</a></p></body></html>");
close HTML;
# Test
-#$get = HTTP::Request->new( "GET", '192.168.0.144/cgi-bin/'.$uid );
-
#######################
# Erstellen einer #
# Feedback-Seite zum #
@@ -120,10 +105,7 @@
),
-title => 'CGI-Feedback'
);
-
-# $cgi->h1 ('Testen wir mal'),"<br>",$cgi->i('Countdown: ');
$cgi->h1( 'CGI-Feedback vom Programm ', $cgi->i('send') );
-
foreach my $Feld (@Feldnamen) {
print $cgi->strong('Feldname: '),
$Feld,
@@ -132,16 +114,17 @@
}
print $cgi->i($uid), $cgi->end_html;
-my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
-if ($min >= 55){
- $min +=5;
- $min -=60;
- $hour +=1;
+my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =
+ localtime(time);
+if ( $min >= 55 ) {
+ $min += 5;
+ $min -= 60;
+ $hour += 1;
}
else {
- $min +=5;
+ $min += 5;
}
-open (WRITE, "|at $hour:$min") or die;
+open( WRITE, "|sudo at $hour:$min" ) or die;
print WRITE "rm /var/www/$uid*\n";
print WRITE "rm /var/www/download/$uid*\n";
close WRITE;