|< 1 2 3 >| | 22 Einträge, 3 Seiten |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
#!/usr/bin/perl -w # Formular.pl sends a formated email with formular input (independend of number of fields) # 25.08.03 (spr) use strict; use CGI::Carp qw(fatalsToBrowser); # Input and formate read(STDIN, my $Daten, $ENV{'CONTENT_LENGTH'}); my @Formularfelder = split(/&/, $Daten); my ($Feld, $Name, $Wert); my %Formular; foreach $Feld (@Formularfelder) { (my $Name, my $Wert) = split(/=/, $Feld); $Wert =~ tr/+/ /; $Wert =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $Wert =~ s/</</g; $Wert =~ s/>/>/g; $Formular{$Name} = $Wert; } # Output # HTML-output my $test = 0; if( $test != 0) { # for testing print "Content-type: text/html\n\n"; print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">', "\n"; print "<html><head><title>CGI-Feedback</title></head>\n"; print "<body><h1>Resultate von <i>Formular.pl</i></h1>\n"; print "<b>Übertragene Daten:</b><br>"; while (($Name, $Wert) = each(%Formular)) { print "Das Formularfeld $Name besitzt den Wert $Wert.<br>\n"; } print "</body></html>\n"; } else { use CGI qw(redirect); print redirect("http://www.perl-community.de"); # print "Content-type: text/html\n\n"; # print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">', "\n"; # print "<html><head><title>$Formular{Formular}</title></head>\n"; # print "<body><h1>Danke für Ihre Anfrage</h1>\n"; # print # print "</body></html>\n"; } # Automatic Email sending my $Sendmail_Prog = 'sendmail.exe'; open (MAIL, "|$Sendmail_Prog -t") || die "Mailprogramm konnte nicht gestartet werden\n"; ...usw...
Quoteprint "Content-type: text/html\n\n";
open HTML,'<html.html';
print <HTML>;
close HTML;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#! /usr/bin/perl -w use strict; use diagnostics; use warnings; use CGI; use CGI::Carp qw(fatalsToBrowser); my $cgi = CGI->new(); my %params = $cgi->Vars(); #damit hast Du schon mal das parsen der Eingaben gespart... my $test = 0; # ??? ich versteh nicht so ganz was das soll, übernehme es aber von dir... if($test != 0){ # kann bei deinem Skript allerdings nie passieren print $cgi->header(-type => 'text/html', -status => '200 OK'); print "Ausgabe...."; } else{ print $cgi->redirect(-url => "http://www.perl-community.de"); } my $sendmail = '/usr/bin/sendmail'; #...usw. ...
1
2
3
4
5
6
7
8
9
10
11
12
13
# Input and formate
read(STDIN, my $Daten, $ENV{'CONTENT_LENGTH'});
my @Formularfelder = split(/&/, $Daten);
my ($Feld, $Name, $Wert);
my %Formular;
foreach $Feld (@Formularfelder) {
 (my $Name, my $Wert) = split(/=/, $Feld);
 $Wert =~ tr/+/ /;
 $Wert =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex(&ũ))/eg;
 $Wert =~ s/</</g;
 $Wert =~ s/>/>/g;
 $Formular{$Name} = $Wert;
}
1 2 3 4 5 6 7 8 9
my $file = "html.html"; unless (open (HTML, $file)) { Â Â print "Fehler: konnte die Datei '$file' nicht oeffnen: $! "; } else { Â Â print <HTML>; Â Â close HTML; }
1 2 3 4 5 6 7 8 9
my $file = "html.html"; unless (open (HTML, $file)) { print "Fehler: konnte die Datei '$file' nicht oeffnen: $! "; } else { print <HTML>; close HTML; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#!/usr/bin/perl -w # Formular.pl sends a formated email with formular input (independend of number of fields) # 25.08.03 (spr) use strict; use CGI::Carp qw(fatalsToBrowser); # Input and format use CGI; my $cgi = CGI->new(); my %Formular = $cgi->Vars(); # Output # HTML-output my $test = 1; if( $test != 0) { # for testing print "Content-type: text/html\n\n"; print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">', "\n"; print "<html><head><title>CGI-Feedback</title></head>\n"; print "<body><h1>Resultate von <i>Formular.pl</i></h1>\n"; print "<b>Übertragene Daten:</b><br>"; while (($Name, $Wert) = each(%Formular)) { print "Das Formularfeld $Name besitzt den Wert $Wert.<br>\n"; } print "</body></html>\n"; }
1
2
3
4
5
6
7
8
9
10
11
12
Software error:
Global symbol "$Name" requires explicit package name at c:\inetpub\scripts\formular.pl line 25.
Global symbol "$Wert" requires explicit package name at c:\inetpub\scripts\formular.pl line 25.
Global symbol "$Name" requires explicit package name at c:\inetpub\scripts\formular.pl line 26.
Global symbol "$Wert" requires explicit package name at c:\inetpub\scripts\formular.pl line 26.
Global symbol "$Name" requires explicit package name at c:\inetpub\scripts\formular.pl line 93.
Global symbol "$Wert" requires explicit package name at c:\inetpub\scripts\formular.pl line 93.
Global symbol "$Wert" requires explicit package name at c:\inetpub\scripts\formular.pl line 94.
Global symbol "$Name" requires explicit package name at c:\inetpub\scripts\formular.pl line 94.
Execution of c:\inetpub\scripts\formular.pl aborted due to compilation errors.
For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.
Quotemy $test = 0; # ich versteh nicht so ganz was das soll, übernehme es aber von dir...
if($test != 0){ # kann bei deinem Skript allerdings nie passieren
|< 1 2 3 >| | 22 Einträge, 3 Seiten |