Forum Moderators: coopster
Noticed if someone does not enter a properly formatted email address, they are redirected to a page with a php error.
Warning: Cannot modify header information - headers already sent by (output started at /home/imlendin/public_html/an/phpmail/formmail.php:259) in /home/imlendin/public_html/an/phpmail/formmail.php on line 63
Line 63 refers to a line with Jack's formail which is called the "mighty error function." Evidently, because of the improperly formatted email address the script is generating an error page.
Can anyone tell me how I can change the formail script to redirect a user to an error page I create rather then sending them to a php error page or the standard Jack's error page? I believer looking at the code below, I have the error page value set to 0.
Here's the snippet of script which contains the error function:
// our mighty error function..
function print_error($reason,$type = 0) {
build_body($title, $bgcolor, $text_color, $link_color, $vlink_color, $alink_color, $style_sheet);
// for missing required data
if ($type == "missing") {
if (missing_field_redirect) {
header("Location: $missing_field_redirect?error=$reason"); Line 63
exit;
} else {
?>
The form was not submitted for the following reasons:<p>
<ul><?
echo $reason."\n";
?></ul>
Please use your browser's back button to return to the form and try again.<?
}
} else { // every other error
?>
The form was not submitted because of the following reasons:<p>
<?
}
echo "<br><br>\n";
echo "<small>This form is powered by <a href=\"http://www.somedomain.com/scripts/\">Jack's Formmail.php ".VERSION."</a></small>\n\n";
exit;
}
In your code, the error generated by the missing variable ("missing_feld_redirect" without the quotes is neither a string nor a variable ... it's just undefined gobbledygook to the script) or improperly-formatted string (where a properly-formatted string would be like "missing_field_redirect", with the quotes to define the string) was/is the thing that was sent to STDIN, which violated the rules for proper execution of the
header() function. No output to STDIN allowed before you invoke a header()-family function. BTW, I checked your code against the current code to find the content of my last post.
[edited by: coopster at 2:34 pm (utc) on Sep. 9, 2005]
[edit reason] unlinked url [/edit]
Is it possible to turn off the error function? I edited the script as you suggested, but I just got an email from client who says they received the error about an unauthorized domain. Not possible from what I know, because I included all domain names they own as well as their IP address. My only guess is that this may be happening since they are using a shared IP.
I have used this script many times, and never seen the unathorized domain error, but all the other sites I have installed the script on used dedicated IP addresses.
I would really like to disable the security and error messages. Is that possible?