[CGI] cgi Mailerscript - Verweis nach Absenden auf andere HTML-Doc

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • [CGI] cgi Mailerscript - Verweis nach Absenden auf andere HTML-Doc

    Halli Hallo !
    Bin auf dem GGI eher Neuling. Im folgenden poste ich ein cgi script.
    Es ist ein mailer script.
    Habe es in meine Seite eingebaut und es funktioniert einwandfrei. Allerdings, wenn man das Formular absendet, wird eine Tabelle angezeigt, wo nocheinmal alle Daten angezeigt werden, die man im Formular eingetragen hat.
    Wäre nett, wenn mir jemand im Script die Stelle zeigen könnte, wo man auf ein anderes HTML-Doc verweist, dass dann sowas ausgibt wie z.B
    "Vielen Dank für Ihr Interesse..." (irgendsowas in der Art)
    Mit dem dazugehörigen befehl.

    Ich denke ich habe die Stelle im script schon gefunden. Nur das "WIE" ist die Frage. Wäre für Eure Hilfe sehr dankbar.

    Hier das Script:

    #! /usr/bin/perl

    # #

    # E i n s t e l l u n g e n f a n g e n h i e r a n! #

    #/---------------------------------------------------------------------\#

    %CFG = (

    EMPFAENGER => 'tante_horst@hotmail.com',

    BACK_URL => 'http://www.xn--fuldabrck-w9a.de',

    MAIL_PROG => '/usr/sbin/sendmail',

    SAVE_MAIL_IN_LOG_FILE => 'YES',

    LOG_FILE => '../logs/formularmailer.log',

    USE_FLOCK => '0',

    SIGNATURE_FILE => 'http://www.xn--fuldabrck-w9a.de/cgi-bin/formularmailer.sig',

    HTML_HEADER_FILE => 'http://www.xn--fuldabrck-w9a.de/cgi-bin/header.htm', ----------à Hatte es hier mal Probiert!?!

    HTML_FOODER_FILE => 'http://www.xn--fuldabrck-w9a.de/cgi-bin/header.htm', ---------à und hier !?!

    SUBJECT_MAIL => 'LAN-Party Teilnahme',

    FONT_FACE => 'arial',

    GUI_COLOR_1 => '#000000',

    GUI_COLOR_2 => '#f5f5ff',

    TABLE_WIDTH => '700',

    CHARSET => 'iso8859-1',

    TXT_BEFORE_DATA => 'Wir haben Ihre Anfrage erhalten und werden diese schnellstmöglichst bearbeiten und uns bei Ihnen per EMail melden!',

    TXT_BEFORE_INPUT => 'Ihre Formulardaten lauten:',

    ANREDE_HERR => 'Sehr geehrter Herr',

    ANREDE_FRAU => 'Sehr geehrte Frau',

    ANREDE_OTHER => 'Sehr geehrte Damen und Herren',

    STD_ERROR => 'mailer@xn--fuldabrck-w9a.de',

    VERSION => '0.815,

    );

    #\---------------------------------------------------------------------/#

    # #

    # #

    #########################################################################



    #///////////////////////////////////////////////////////////////////////#

    # #

    #///////////////////////////////////////////////////////////////////////#



    if ($ENV{'REQUEST_METHOD'} =~ /GET/i) {

    $names_values = $ENV{'QUERY_STRING'}

    }

    elsif ($ENV{'REQUEST_METHOD'} =~ /POST/i) {

    read(STDIN, $names_values, $ENV{'CONTENT_LENGTH'});

    }

    else {

    ($names_values) = @ARGV;

    }



    @NAMES_VALUES = split(/&/, $names_values);

    foreach $name_value (@NAMES_VALUES) {

    ($name, $value) = split(/=/, $name_value);

    $name =~ tr/+/ /;

    $value =~ tr/+/ /;

    $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

    $INPUT{$info1} = $value;

    if (($name ne '') && ($value ne '')) {

    push(@FORM_INPUT, $name, $value);

    }

    }



    if ($INPUT{ANREDE} eq '') {

    $INPUT{ANREDE} = 'NOBODY';

    }

    if ($INPUT{NAME} eq '') {

    $INPUT{NAME} = 'NOBODY';

    }

    if ($INPUT{EMAIL} eq '') {

    $INPUT{EMAIL} = $CFG{STD_ERROR};

    }



    &SAVE_IN_LOGFILE;

    &SEND_MAIL_TO_EMPFAENGER;

    &SEND_MAIL_TO_SENDER;

    &HTTP_HEADER(0);

    &HTML_MAIN;



    #///////////////////////////////////////////////////////////////////////#

    # #

    #///////////////////////////////////////////////////////////////////////#



    sub SAVE_IN_LOGFILE {

    if ($CFG{SAVE_MAIL_IN_LOG_FILE} eq 'YES') {

    if ($CFG{USE_FLOCK} == 1) {

    use Fcntl ':flock';

    }

    open(LOG_FILE, ">>$CFG{LOG_FILE}") || print STDERR "COULD NOT OPEN $CFG{LOG_FILE} TO WRITE: $!\n";

    if ($CFG{USE_FLOCK} == 1) {

    flock(LOG_FILE, LOCK_EX) || print STDERR "COULD NOT FLOCK $CFG{LOG_FILE}: $!\n";

    }



    my $i=0;

    while ($FORM_INPUT[$i] ne '') {

    unless ($FORM_INPUT[$i] =~ /x|y/i) {

    print LOG_FILE "$FORM_INPUT[$i]\: $FORM_INPUT[$i+1]\n";

    }

    $i+=2;

    }

    print LOG_FILE "\n------------------------------------------------------\n\n";

    close(LOG_FILE);

    }

    }



    #///////////////////////////////////////////////////////////////////////#

    # #

    #///////////////////////////////////////////////////////////////////////#



    sub SEND_MAIL_TO_EMPFAENGER {

    open(EMPFAENGER_MAIL, "|$CFG{MAIL_PROG} $CFG{EMPFAENGER}") || print "COULD NOT OPEN $CFG{MAIL_PROG} TO PIPE: $!\n";

    print EMPFAENGER_MAIL ("To: $CFG{EMPFAENGER}\n");

    print EMPFAENGER_MAIL ("From: $INPUT{EMAIL}\n");

    print EMPFAENGER_MAIL ("Subject: $CFG{SUBJECT_MAIL}\n\n");

    Ich vermiute malhier in dem ROT markierten Bereich muss auf das HTML-Doc verwiesen werden oder???

    print EMPFAENGER_MAIL "------------------------------------------------------\n";

    my $i=0;

    while ($FORM_INPUT[$i] ne '') {

    unless ($FORM_INPUT[$i] =~ /x|y/i) {

    print EMPFAENGER_MAIL "$FORM_INPUT[$i]\: $FORM_INPUT[$i+1]\n";

    }

    $i+=2;

    }

    print EMPFAENGER_MAIL "------------------------------------------------------\n\n";
    close(EMPFAENGER_MAIL);

    }



    #///////////////////////////////////////////////////////////////////////#

    # #

    #///////////////////////////////////////////////////////////////////////#



    sub SEND_MAIL_TO_SENDER {

    if ($INPUT{EMAIL} ne $CFG{STD_ERROR}) {

    open(SENDER_MAIL, "|$CFG{MAIL_PROG} $INPUT{EMAIL}") || print STDERR "COULD NOT OPEN $CFG{MAIL_PROG} TO PIPE: $!\n";

    print SENDER_MAIL ("To: $INPUT{EMAIL}\n");

    print SENDER_MAIL ("From: $CFG{EMPFAENGER}\n");

    print SENDER_MAIL ("Subject: $CFG{SUBJECT_MAIL}\n\n");



    if ($INPUT{ANREDE} =~ /Herr/i) {

    print SENDER_MAIL "$CFG{ANREDE_HERR} $INPUT{NAME}!\n\n";

    }

    elsif ($INPUT{ANREDE} =~ /Frau/i) {

    print SENDER_MAIL "$CFG{ANREDE_FRAU} $INPUT{NAME}!\n\n";

    }

    else {

    print SENDER_MAIL "$CFG{ANREDE_OTHER}!\n\n";

    }



    print SENDER_MAIL "$CFG{TXT_BEFORE_DATA}\n\n";

    print SENDER_MAIL "$CFG{TXT_BEFORE_INPUT}\n";

    print SENDER_MAIL "------------------------------------------------------\n";

    my $i=0;

    while ($FORM_INPUT[$i] ne '') {

    unless ($FORM_INPUT[$i] =~ /x|y/i) {

    print SENDER_MAIL "$FORM_INPUT[$i]\: $FORM_INPUT[$i+1]\n";

    }

    $i+=2;

    }

    print SENDER_MAIL "------------------------------------------------------\n\n";



    open(SIGNATURE_FILE, "<$CFG{SIGNATURE_FILE}") || print STDERR "COULD NOT OPEN $CFG{SIGNATURE_FILE}: $!\n";

    print SENDER_MAIL <SIGNATURE_FILE>;

    close(SIGNATURE_FILE);

    close(SENDER_MAIL);

    }

    }



    #///////////////////////////////////////////////////////////////////////#

    # #

    #///////////////////////////////////////////////////////////////////////#



    sub HTTP_HEADER {

    ($_) = @_;

    $|=1;

    print "Expires: ". gmtime(time + $_) ." GMT\n";

    print "Last-Modified: ". gmtime(time) ." GMT\n";

    print "Content-Type: text/html;charset=$CFG{CHARSET}\n\n";

    }



    #///////////////////////////////////////////////////////////////////////#

    # #

    #///////////////////////////////////////////////////////////////////////#



    sub HTML_MAIN {

    if (-f "$CFG{HTML_HEADER_FILE}") {

    open (HTML_HEADER, "< $CFG{HTML_HEADER_FILE}") || print STDERR "$CFG{HTML_HEADER_FILE}: $!\n";

    print <HTML_HEADER>;

    close (HTML_HEADER);

    }

    else {

    print "<html><head><title>formularmailer.pl/$CFG{VERSION}</title></head>\n";

    print "<body text=\"#00000\" bgcolor=\"#f5f5ff\">\n";

    }



    print "<table border=\"0\" width=\"$CFG{TABLE_WIDTH}\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"center\">";

    print "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"$CFG{GUI_COLOR_1}\"><tr><th>\n";

    print "<table border=\"0\" width=\"100%\" cellspacing=\"1\" cellpadding=\"0\"><tr><td align=\"center\" bgcolor=\"$CFG{GUI_COLOR_2}\">\n";

    print "<br><table border=\"0\" width=\"80%\" cellspacing=\"0\" cellpadding=\"0\">\n";

    $i=0;

    while ($FORM_INPUT[$i] ne '') {

    print "<tr><td width=\"20%\"><font face=\"$CFG{FONT_FACE}\" size=\"2\"><b><i>$FORM_INPUT[$i]</i></b>:</font></td><td width=\"80%\"><font face=\"$CFG{FONT_FACE}\" size=\"2\">$FORM_INPUT[$i+1]</font></td></tr>\n";

    $i+=2;

    }

    print "</table>\n";

    print "<font face=\"$CFG{FONT_FACE}\" size=\"2\"><p align=\"center\"><a href=\"$CFG{BACK_URL}\">Zurück</a><br>&nbsp;</p></font>\n";

    print "</td></tr></table></th></tr></table>\n";

    print "<p align=\"center\"><font face=\"$CFG{FONT_FACE}\" size=\"1\">formularmailer.pl/$CFG{VERSION} - <a href=\"http://www.xn--fuldabrck-w9a.de/\">http://www.xn--fuldabrck-w9a.de/</a></font></p>\n";

    print "</td></tr></table>\n";



    if (-f "$CFG{HTML_FOOER_FILE}") {

    open (HTML_FOODER, "< $CFG{HTML_FOOER_FILE}") || print STDERR "$CFG{HTML_FOOER_FILE}: $!\n";

    print <HTML_FOODER>;

    close (HTML_FOODER);

    }

    else {

    print "</body></html>";

    }

    }



    exit;


    mfg


    Tante_Horst
Lädt...
X