Şimdiye kadar e-posta gönderir ama ne yaparsam ne (sunucu hataları) yönlendirme olmayacak ve ben bir özel hata sayfası için yönlendirmek gerekir.
Nasıl o iş yapmak için bunu değiştirmek istiyorsunuz?
Orijinal kod:
# If any error fields have been found, send error message to the user. #
if (@error) { &error('missing_fields', @error) }
yeni kod:
if (@error) { # Print HTTP header and opening HTML tags. #
print "Content-type: text/html\n\n";
print "<html>\n <head>\n";
# Print out title of page #
if ($Config{'title'}) { print "<title>$safeConfig{'title'}</title>\n" }
else { print "<title>Thank You</title>\n" }
print " </head>\n <body";
# Get Body Tag Attributes #
&body_attributes;
# Close Body Tag #
print ">\n <center>\n";
# Print custom or generic title. #
if ($Config{'title'}) { print "<h1>$safeConfig{'title'}</h1>\n" }
else { print "<h1>Thank You For Filling Out This Form</h1>\n" }
print "</center>\n";
print "Below is what you submitted to $safeConfig{'recipient'} on ";
print "$date<p><hr size=1 width=75\%><p>\n";
# If a sort order is specified, sort the form fields based on that. #
if ($Config{'sort'} =~ /^order:.*,.*/) {
# Set the temporary $sort_order variable to the sorting order, #
# remove extraneous line breaks and spaces, remove the order: #
# directive and split the sort fields into an array. #
$sort_order = $Config{'sort'};
$sort_order =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$sort_order =~ s/(\s+)?\n+(\s+)?//g;
$sort_order =~ s/order://;
@sorted_fields = split(/,/, $sort_order);
# For each sorted field, if it has a value or the print blank #
# fields option is turned on print the form field and value. #
foreach $sorted_field (@sorted_fields) {
local $sfname = &clean_html($sorted_field);
if ($Config{'print_blank_fields'} || $Form{$sorted_field} ne '') {
print "<b>$sfname:</b> $Form{$sorted_field}<p>\n";
}
}
}
# Otherwise, use the order the fields were sent, or alphabetic. #
else {
# Sort alphabetically if requested.
if ($Config{'sort'} eq 'alphabetic') {
@Field_Order = sort @Field_Order;
}
# For each form field, if it has a value or the print blank #
# fields option is turned on print the form field and value. #
foreach $field (@Field_Order) {
local $fname = &clean_html($field);
if ($Config{'print_blank_fields'} || $Form{$field} ne '') {
print "<b>$fname:</b> $Form{$field}<p>\n";
}
}
}
print "<p><hr size=1 width=75%><p>\n";
# Check for a Return Link and print one if found. #
if ($Config{'return_link_url'} && $Config{'return_link_title'}) {
print "<ul>\n";
print "<li><a href=\"$safeConfig{'return_link_url'}\">$safeConfig{'return_link_title'}</a>\n";
print "</ul>\n";
}
# Print the page footer. #
print <<"(END HTML FOOTER)";
<hr size=1 width=75%><p>
<center><font size=-1><a href="http://www.scriptarchive.com/formmail.html">FormMail</a> V1.92 © 1995 - 2002 Matt Wright<br>
A Free Product of <a href="http://www.scriptarchive.com/">Matt's Script Archive, Inc.</a></font></center>
</body>
</html>
(END HTML FOOTER)
}
}
sub send_mail {
# Localize variables used in this subroutine. #
local($print_config,$key,$sort_order,$sorted_field,$env_report);
# Open The Mail Program
open(MAIL,"|$mailprog 1>&2");
print MAIL "To: $Config{'recipient'}\n";
print MAIL "From: $Config{'email'} ($Config{'realname'})\n";
# Check for Message Subject
if ($Config{'subject'}) { print MAIL "Subject: $Config{'subject'}\n\n" }
else { print MAIL "Subject: WWW Form Submission\n\n" }
print MAIL "Below is the result of your feedback form. It was submitted by\n";
print MAIL "$Config{'realname'} ($Config{'email'}) on $date\n";
print MAIL "-" x 75 . "\n\n";
if (@Print_Config) {
foreach $print_config (@Print_Config) {
if ($Config{$print_config}) {
print MAIL "$print_config: $Config{$print_config}\n\n";
}
}
}
# If a sort order is specified, sort the form fields based on that. #
if ($Config{'sort'} =~ /^order:.*,.*/) {
# Remove extraneous line breaks and spaces, remove the order: #
# directive and split the sort fields into an array. #
local $sort_order = $Config{'sort'};
$sort_order =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$sort_order =~ s/(\s+)?\n+(\s+)?//g;
$sort_order =~ s/order://;
@sorted_fields = split(/,/, $sort_order);
# For each sorted field, if it has a value or the print blank #
# fields option is turned on print the form field and value. #
foreach $sorted_field (@sorted_fields) {
if ($Config{'print_blank_fields'} || $Form{$sorted_field} ne '') {
print MAIL "$sorted_field: $Form{$sorted_field}\n\n";
}
}
}
# Otherwise, print fields in order they were sent or alphabetically. #
else {
# Sort alphabetically if specified: #
if ($Config{'sort'} eq 'alphabetic') {
@Field_Order = sort @Field_Order;
}
# For each form field, if it has a value or the print blank #
# fields option is turned on print the form field and value. #
foreach $field (@Field_Order) {
if ($Config{'print_blank_fields'} || $Form{$field} ne '') {
print MAIL "$field: $Form{$field}\n\n";
}
}
}
print MAIL "-" x 75 . "\n\n";
# Send any specified Environment Variables to recipient. #
foreach $env_report (@Env_Report) {
if ($ENV{$env_report}) {
print MAIL "$env_report: $ENV{$env_report}\n";
}
}
close (MAIL);
}
sub return_html {
# Local variables used in this subroutine initialized. #
local($key,$sort_order,$sorted_field);
# Now that we have finished using form values for any e-mail related #
# reasons, we will convert all of the form fields and config values #
# to remove any cross-site scripting security holes. #
local($field);
foreach $field (keys %Config) {
$safeConfig{$field} = &clean_html($Config{$field});
}
foreach $field (keys %Form) {
$Form{$field} = &clean_html($Form{$field});
}
# If redirect option is used, print the redirectional location header. #
if ($Config{'redirect'}) {
print "Location: $safeConfig{'redirect'}\n\n";
}