franz
- cgi
hi leutz
ich hab wieder mal ein prob und zwar:
In der oben genannten seite, hab ich ein formular, dass an ein cgi script -- /cgi-bin/mail.pl -- geschickt werden soll, nur irgendwie funzt es nicht
hier ist der quellcode des scripts:
$ErrorPage = "http://www34.brinkster.com/viruza/failed.htm";
$ThankPage = "http://www34.brinkster.com/viruza/thanks.htm";
$EvilReferer = "http://www.somesite.com";
$YourEmail = 'virus-a@aon.at';
@referers = ('www34.brinkster.com/viruza','');
$MailProgram = '/cgi-bin/alphamail.pl';
$Subject = "kingofqueens";
$Header = "kingofqueens";
$TailMessage = "Danke, für deine E-Mail. Wir werden in den nächsten 24 Stunden antoworten.";
$Signature1 = "franz.";
$Signature2 = "kingofqueens";
&CheckReferingURL;
&ReadParse;
$Name = $in{'Name'};
$Email = $in{'Email'};
$ICQ = $in{'ICQ'};
$Message = $in{'Message'};
&CheckEmailAddressFormat;
&CheckFields;
&GetDate;
&SendSubmission;
&SendAutoReply;
print "Location: $ThankPage\n\n";
exit;
sub SendSubmission {
open (MAIL,"|$MailProgram -t");
print MAIL "To: $YourEmail\n";
print MAIL "From: $Email\n";
print MAIL "Subject: $Subject\n";
print MAIL "$Date\n\n";
print MAIL "E-Mail Message\n\n";
print MAIL "From: $Name\n";
print MAIL "Email: $Email\n\n";
print MAIL "Message:\n\n";
print MAIL "ICQ: $ICQ\n";
print MAIL "$Message\n\n";
close (MAIL);
}
sub SendAutoReply {
open (MAIL,"|$MailProgram -t");
print MAIL "To: $Email\n";
print MAIL "From: $YourEmail\n";
print MAIL "Subject: $Subject\n";
print MAIL "$Header\n";
print MAIL "$Date\n\n";
print MAIL "$Subject\n\n";
print MAIL "You sent the following:\n\n";
print MAIL "==============================\n\n";
print MAIL "Name: $Name\n";
print MAIL "Email: $Email\n\n";
print MAIL "Message:\n\n";
print MAIL "$Message\n\n";
print MAIL "==============================\n\n";
print MAIL "$TailMessage\n\n";
print MAIL "Best regards,\n\n\n";
print MAIL "$Signature1\n";
print MAIL "$Signature2\n\n";
close (MAIL);
}
sub GetDate {
@days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
@months = ('01','02','03','04','05','06','07','08','09','10','11','12');
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = $year+1900;
$Date = "$days[$wday] $months[$mon]/$mday/$year";
}
sub ReadParse { local (*in) = @_ if @_;
local ($i, $key, $val); if ( $ENV{'REQUEST_METHOD'} eq "GET" )
{$in = $ENV{'QUERY_STRING'};}
elsif ($ENV{'REQUEST_METHOD'} eq "POST")
{read(STDIN,$in,$ENV{'CONTENT_LENGTH'});}
else {
$in = ( grep( !/^-/, @ARGV )) [0];
$in =~ s/\&/&/g; } @in = split(/&/,$in);
foreach $i (0 .. $#in) {
$in[$i] =~ s/+/ /g;
($key, $val) = split(/=/,$in[$i],2);
$key =~ s/%(..)/pack("c",hex($1))/ge;
$val =~ s/%(..)/pack("c",hex($1))/ge;
$in{$key} .= "\0" if (defined($in{$key}));
$in{$key} .= $val; } return length($in); }
sub CheckEmailAddressFormat {
if (index($Email, "@") < 1) {&DoEmailError;}
if (index($Email, ".") < 1) {&DoEmailError;}
if (index($Email, " ") > -1) {&DoEmailError;}
}
sub CheckFields {
if (!$Name || $Name eq ' ') {&DoEmailError;}
if (!$Email || $Email eq ' ') {&DoEmailError;}
if (!$Message || $Message eq ' ') {&DoEmailError;}
}
sub DoEmailError {
print "Location: $ErrorPage\n\n";
exit;
}
sub CheckReferingURL {
if ($ENV{'HTTP_REFERER'}) {
foreach $referer (@referers) {
if ($ENV{'HTTP_REFERER'} =~ /$referer/i) {
$check_referer = '1';
last;
}}}
else {$check_referer = '1';}
if ($check_referer != 1) {
print "Location: $EvilReferer\n\n";
exit;
}}
exit;
was ist falsch?
danke im voraus...
gruß vom franz