CurrentWave
07-24-2003, 01:07 AM
I have a Perl script I am trying to customize, but I only know PHP help!
Here is the top part of the original -
-----------------------
#!/usr/bin/perl
######################################################################
# Subject : This program will parse all the GET method data.
######################################################################
push (@INC, "perl5/lib");
print "Content-type: text/html \n\n";
$FORM_DATA = $ENV{'QUERY_STRING'};
foreach (split(/&/, $FORM_DATA))
{
($NAME, $VALUE) = split(/=/, $_);
$NAME =~ s/\+/ /g;
$NAME =~ s/%([0-9|A-F]{2})/pack(C,hex($1))/eg;
$VALUE =~ s/\+/ /g;
$VALUE =~ s/%([0-9|A-F]{2})/pack(C,hex($1))/eg;
# Find unique Variable Name for every variable coming in from the form input
$NUM = 0;
while ($MYVARS{$NAME} ne "")
{
$NUM++;
$NAME =~ s/\.([0-9]+$)|$/\.$NUM/;
}
# Store Variable NAME=Variable VALUE pair
$MYVARS{$NAME} = $VALUE;
}
$Success = "$MYVARS{'Status'}";
$ID = "$MYVARS{'ID'}";
$Name = "$MYVARS{'NameonCard'}";
$Street = "$MYVARS{'Cardstreet'}";
$City = "$MYVARS{'Cardcity'}";
$State = "$MYVARS{'Cardstate'}";
$Country = "$MYVARS{'Cardcountry'}";
$Email = "$MYVARS{'Email'}";
## You can receive the rest of the documented key=value pairs by following the code above. #
----------------------------------
And here is the part I'm adding -
use strict;
use Mail::Mailer;
If $Success = 1; {
my $body = "Another successful donation was made. \n";
$body = "Here is the information - \n";
$body = $ID "\n" $Name "\n\n" $Street "\n" $City " " $State " " $Country "\n" $Email "\n"
my $mailer = Mail::Mailer->new("sendmail");
$mailer->open({ From => "webmaster@kenwood.org",
To => "JMM@kenwood.org",
Subject => "A Donation was made",
});
print $mailer $body;
$mailer->close();
exit;
}
# This is the end of email
----------------------------------
Can some one touch up the syntax on the second email part that I have added. I've composed this from other scripts and it isn't completely right.
Do I need the exit; ? Because I have html that gets printed later on in the script and I don't want to break out of anything.
Thanks a bunch,
A Perl Neebie
Here is the top part of the original -
-----------------------
#!/usr/bin/perl
######################################################################
# Subject : This program will parse all the GET method data.
######################################################################
push (@INC, "perl5/lib");
print "Content-type: text/html \n\n";
$FORM_DATA = $ENV{'QUERY_STRING'};
foreach (split(/&/, $FORM_DATA))
{
($NAME, $VALUE) = split(/=/, $_);
$NAME =~ s/\+/ /g;
$NAME =~ s/%([0-9|A-F]{2})/pack(C,hex($1))/eg;
$VALUE =~ s/\+/ /g;
$VALUE =~ s/%([0-9|A-F]{2})/pack(C,hex($1))/eg;
# Find unique Variable Name for every variable coming in from the form input
$NUM = 0;
while ($MYVARS{$NAME} ne "")
{
$NUM++;
$NAME =~ s/\.([0-9]+$)|$/\.$NUM/;
}
# Store Variable NAME=Variable VALUE pair
$MYVARS{$NAME} = $VALUE;
}
$Success = "$MYVARS{'Status'}";
$ID = "$MYVARS{'ID'}";
$Name = "$MYVARS{'NameonCard'}";
$Street = "$MYVARS{'Cardstreet'}";
$City = "$MYVARS{'Cardcity'}";
$State = "$MYVARS{'Cardstate'}";
$Country = "$MYVARS{'Cardcountry'}";
$Email = "$MYVARS{'Email'}";
## You can receive the rest of the documented key=value pairs by following the code above. #
----------------------------------
And here is the part I'm adding -
use strict;
use Mail::Mailer;
If $Success = 1; {
my $body = "Another successful donation was made. \n";
$body = "Here is the information - \n";
$body = $ID "\n" $Name "\n\n" $Street "\n" $City " " $State " " $Country "\n" $Email "\n"
my $mailer = Mail::Mailer->new("sendmail");
$mailer->open({ From => "webmaster@kenwood.org",
To => "JMM@kenwood.org",
Subject => "A Donation was made",
});
print $mailer $body;
$mailer->close();
exit;
}
# This is the end of email
----------------------------------
Can some one touch up the syntax on the second email part that I have added. I've composed this from other scripts and it isn't completely right.
Do I need the exit; ? Because I have html that gets printed later on in the script and I don't want to break out of anything.
Thanks a bunch,
A Perl Neebie