WCM - Das österreichische Computer Magazin Forenübersicht
 

Zurück   WCM Forum > Rat & Tat > Programmierung

Programmierung Rat & Tat für Programmierer

Microsoft KARRIERECAMPUS

 
 
Themen-Optionen Ansicht
Alt 28.06.2001, 16:01   #7
mqs
Master
 
Registriert seit: 08.05.2001
Alter: 44
Beiträge: 533


mqs eine Nachricht über ICQ schicken
Standard Fehler 403

Ich bekomme immer :
Access Forbidden HTTP 403 Error

Mein Perl Script schaut so aus:


#!/usr/bin/perl
################################################## ####################

$SENDMAIL = '/usr/sbin/sendmail';

@AUTHURLS = ('nrg.strikenet.at');

$TO = 'mqs@gmx.ch';

$SUBJECT = 'Subject';

$REDIRECT = 'http://nrg.strikenet.at/mailsuc.htm';

$SORT_TYPE = 'none';

@SORT_FIELDS = ('Field1', 'Field2', 'Field3', 'Field4', 'Field5', 'Field6', 'Field7');

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

# Check to make sure this script was called by an authorized URL(s)

&check_url;

# Format Local Date/Time for Email Message Date

&get_date;

# Reformat Form Contents

&reformat_form_data;

# Send the form data to the recipient via e-mail

&send_email;

# Redirect user to confirmation page

print "Location: $REDIRECT\n\n";

exit();

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

sub check_url
{
if ($ENV{'HTTP_REFERER'})
{
foreach $AUTHURL (@AUTHURLS)
{
if ($ENV{'HTTP_REFERER'} =~ /$AUTHURL/i)
{
$check_url = '1';
last;
}
}
}
else
{
$check_url = '1';
}

if ($check_url != 1)
{
print "Content-type: text/html\n\n";
print "<html>\n <head>\n <title>Unauthorized URL Referrer - Access Denied</title>\n </head>\n";
print " <body>\n <center>\n <h1>Unauthorized URL Referrer - Access Denied</h1>\n </center>\n";
print "The form that is trying to use this script resides at: \n";
print "$ENV{'HTTP_REFERER'}, which is not allowed to access this cgi script.

\n";
print "Sorry!\n";
print "</body></html>\n";
exit;
}

}

sub get_date
{
@days = ('Sunday','Monday','Tuesday','Wednesday','Thursday ','Friday','Saturday');
@months = ('January','February','March','April','May','June' ,'July',
'August','September','October','November','Decembe r');

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isd st) = localtime(time);
if ($hour < 10)
{ $hour = "0$hour"; }
if ($min < 10)
{ $min = "0$min"; }
if ($sec < 10)
{ $sec = "0$sec"; }
$date = "$days[$wday], $months[$mon] $mday, 19$year at $hour\:$min\:$sec";

}

sub reformat_form_data
{
if ($ENV{'REQUEST_METHOD'} eq 'POST')
{
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
}
else
{
print "Content-type: text/html\n\n";
print "<html>\n <head>\n <title>Error: Request Method</title>\n </head>\n";
print "<body>\n <center>\n\n <h1>Error: Request Method</h1>\n </center>\n\n";
print "The Request Method of the Form you submitted was not\n";
print "POST. Please check the form, and make sure the\n";
print "method= statement is in upper case and is set to POST.\n";
print "

<hr size=7 width=75%>

\n";
print "<ul>\n";
print "[*]<a href=\"$ENV{'HTTP_REFERER'}\">Back to the Submission Form</a>\n";
print "[/list]\n";
print "</body></html>\n";
exit;
}
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s///g;
if ($name eq 'email' || $name eq 'Name' && ($value))
{
$CONFIG{$name} = $value;
}
if ($name eq 'to_email' && ($value))
{
$TO = $value;
}
elsif ($name eq 'subject' && ($value))
{
$SUBJECT = $value;
}
elsif ($name eq 'redirect' && ($value))
{
$REDIRECT = $value;
}
elsif ($name eq 'sort_type' && ($value))
{
$SORT_TYPE = $value;
}
elsif ($name eq 'sort_fields' && ($value))
{
@SORT_FIELDS = split(/,/, $value);
}
elsif ($FORM{$name} && ($value))
{
$FORM{$name} = "$FORM{$name}, $value";
}
elsif ($value)
{
$FORM{$name} = $value;
}
}
}

sub send_email
{
# Build the 'from' address of the form: "name <email address>"

$from_name=($CONFIG{'Name'} . " <" . $CONFIG{'email'} . "> ");

open(MAIL,"|$SENDMAIL -t") || die "Can't open $mailprog!\n";

# Output the mail header

print MAIL "To: $TO\r\n";
print MAIL "From: $from_name\r\n";
print MAIL "Reply-To: $from_name\r\n";
print MAIL "Subject: $SUBJECT\r\n\n";

# Output the mail message header with the Local Date/Time

print MAIL "---------------------------------------------------------------\n\n";
print MAIL " The following information was submitted by: \n";
print MAIL " $CONFIG{'Name'} on $date\n\n";
print MAIL "---------------------------------------------------------------\n\n";

# Output the mail body
# Optionally Sort and Print the name and value pairs in FORM array

if ($SORT_TYPE eq 'alphabetic')
{
foreach $key (sort keys %FORM)
{
print MAIL "$key: $FORM{$key}\n\n";
}
}
elsif ($SORT_TYPE eq 'field')
{
foreach $SORT_FIELD (@SORT_FIELDS)
{
if ($FORM{$SORT_FIELD})
{
print MAIL "$SORT_FIELD: $FORM{$SORT_FIELD}\n\n";
}
}
}
else
{
foreach $key (keys %FORM)
{
print MAIL "$key: $FORM{$key}\n\n";
}
}

# Output the mail footer

print MAIL "<REMOTE HOST> $ENV{'REMOTE_HOST'}\n";
print MAIL "<REMOTE ADDRESS> $ENV{'REMOTE_ADDR'}\n";
print MAIL "<USER AGENT> $ENV{'HTTP_USER_AGENT'}\r\n";

# Close the pipe and send the mail

close(MAIL);
}

Vielleicht könnt ihr mir hier weiterhelfen.
mqs ist offline   Mit Zitat antworten
 


Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.

Gehe zu


Alle Zeitangaben in WEZ +2. Es ist jetzt 11:16 Uhr.


Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Forum SEO by Zoints
© 2009 FSL Verlag