WCM Forum

WCM Forum (http://www.wcm.at/forum/index.php)
-   Programmierung (http://www.wcm.at/forum/forumdisplay.php?f=17)
-   -   PERL (http://www.wcm.at/forum/showthread.php?t=24547)

mqs 28.06.2001 14:46

PERL
 
ZU hilf.

I hob A mords problem, und des is perl.
Ich habe eine art Bestellformular ins web gestellt. Es wird ausgefüllt, und sollte nach dem Ausfüllen zu meiner e-mailadresse geschickt werden. Der Server unterstützt auch perl, aber ich bekomme immer einen Fehler. Woran kann das liegen???

In der HTML seite habe ich folgendes eingefügt:
<form action="/cgi-bin/formmail.pl" METHOD="POST">


und beim perl script müsste olles passn

mqs 28.06.2001 14:54

JA ICH KANN DIR HELFEN SCHEISS AUF PERL :P


























MFG MOTTE !! :PPPPPP

Hanneman 28.06.2001 15:04

wie sieht denn dein restlicher html code aus?

müsste die folgende form haben
<form method="POST" action="/cgi-bin/formmail.pl">
<input type=submit value="Mail" name="mail">
</form>

mail steht hier nat. für x beliebigen namen deines bestätigungsbuttons

hast du auch wirklich das pl file in deinem cgi-bin liegen oder vielleicht doch im gleichen verzeichnis wie das html file?

welcher fehler kommt genau? 501 internal server error?

overcooler 28.06.2001 15:09

warum antwortest du dir selbst mit so einem posting...?

aber sonst wie bereits erwähnt
1) was für ein fehler
2) welches perlscript verwendest du?

MZ 28.06.2001 15:16

hast wohl vergessen, deine identität zu wechseln zwischen den postings *G* :D

chmod 755 im cgi-bin Verzeichnis ?
mit ASCII übertragen ?

Philipp 28.06.2001 15:41

mqs:
Ist das FormMail von Matt's Script Archive?

Wenn ja... diese Version hat ein Sicherheitloch das es ermöglicht das andere damit Spam schicken können. Ich würde bei www.hotscripts.com nach Alternativen suchen.

mqs 28.06.2001 16:01

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.

MZ 28.06.2001 16:15

Linuxmaschine (Server) ??? wegen sendmail :D

mqs 28.06.2001 16:24

chmo..???
 
chmod auf 777 setzen
Wo, und wie mache ich das?
Ich benutze CuteFTP zum upload

Hanneman 28.06.2001 16:28

Datei raufladen


Datei markieren, rechte Maustaste, CHMOD einstellen


Alle Zeitangaben in WEZ +2. Es ist jetzt 23:34 Uhr.

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