the contact form on the webpage I am working on is throwing an error. Below is the code and the error log. Any ideas?
<?php
function utf8_urldecode($str) { $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str)); return html_entity_decode($str,null,'ISO-8859-1');; }
function mail_utf8($to, $subject = '(No subject)', $message, $headers) {
$header_ = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n";
return mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $message, $header_ . $headers);
}
//function mail_utf8html($to, $subject = '(No subject)', $message, $headers) {
//$header_ = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=UTF-8' . "\r\n";
//return mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $message, $header_ . $headers);
//}
$stackid = trim($_POST['stackid']);
$cleanowneremail = include(dirname(__FILE__) . '/../'.$stackid.'config_e.php');
$emaillabel = strip_tags($_POST['emaillabel']);
$namelabel = strip_tags($_POST['namelabel']);
$subjectlabel = strip_tags($_POST['subjectlabel']);
$messagelabel = strip_tags($_POST['messagelabel']);
$mail = $_POST['mail'];
$name = strip_tags($_POST['name']);
$subject = strip_tags($_POST['subject']);
$text = trim($_POST['text']);
$text = utf8_urldecode($text);
//$text = stripslashes($text);
//$owneremail = $_POST['owneremail'];
//$cleanowneremail = substr($owneremail, 7); // removes "obscure"
$recipientEmail = explode(',', $cleanowneremail);
foreach($recipientEmail as $value) {
$to = trim($value);
$subject = stripslashes($subject);
$message = trim($emaillabel)." : ".trim($mail)."\n".trim($namelabel)." : ".trim($name)."\n".trim($subjectlabel)." : ".trim($subject)."\n ".trim($messagelabel)." : ".$text."\n\nForm = ".trim($_POST['formname']);
$message = stripslashes($message);
if(trim($_POST['compatibility']) == "true"){
$headers = "From: " . $cleanowneremail . "\n";
}else{
$headers = "From: " . $mail . "\n";
}
$headers .= "Reply-To: ". $mail . "\n";
if(mail_utf8($to,$subject,$message,$headers)){
echo "success"; // we should get this echoed back
}
else{
echo "error";
}
}
$autoreply = trim($_POST['autoreply']);
$autoreply = utf8_urldecode($autoreply);
$autoreplysig = $_POST['autoreplysig']; // if auto reply is selected in the stack
$autoreplysub = $_POST['autosubject'];
if($autoreply != "noreply"){
$autoreplysig = utf8_urldecode($autoreplysig);
$autoreply = stripslashes($autoreply)."<br /><br />".stripslashes($autoreplysig);
//$autoreply .= "<br /><br />Your Message : ".$text;
$autoreplysubject = utf8_urldecode($autoreplysub);
$headers = "From: " . $cleanowneremail . "\r\n";
$headers .= "Reply-To: ". $cleanowneremail . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($mail,$autoreplysubject,$autoreply,$headers);
}
?>
Error log
- [22-Jan-2020 20:28:14 UTC] PHP Notice: Undefined index: stackid in
/home/e5z2aaq161fd/public_html/contactus/files/contactAssets/contactform.php on line 15 - [22-Jan-2020 20:28:14 UTC] PHP Warning:
include(/home/e5z2aaq161fd/public_html/contactus/files/contactAssets/../config_e.php): failed to open stream: No such file or directory in
/home/e5z2aaq161fd/public_html/contactus/files/contactAssets/contactform.php on line 16 - [22-Jan-2020 20:28:14 UTC] PHP Warning: include(): Failed opening
'/home/e5z2aaq161fd/public_html/contactus/files/contactAssets/../config_e.php'
for inclusion (include_path='.:/opt/alt/php72/usr/share/pear') in
/home/e5z2aaq161fd/public_html/contactus/files/contactAssets/contactform.php on line 16 - [22-Jan-2020 20:28:14 UTC] PHP Notice: Undefined index:
emaillabel in
/home/e5z2aaq161fd/public_html/contactus/files/contactAssets/contactform.php on line 19 - [22-Jan-2020 20:28:14 UTC] PHP Notice: Undefined index: namelabel
in
/home/e5z2aaq161fd/public_html/contactus/files/contactAssets/contactform.php on line 20 - [22-Jan-2020 20:28:14 UTC] PHP Notice: Undefined index:
subjectlabel in
/home/e5z2aaq161fd/public_html/contactus/files/contactAssets/contactform.php on line 21 - [22-Jan-2020 20:28:14 UTC] PHP Notice: Undefined index:
messagelabel in
/home/e5z2aaq161fd/public_html/contactus/files/contactAssets/contactform.php on line 22 - [22-Jan-2020 20:28:14 UTC] PHP Notice: Undefined index: formname
in
/home/e5z2aaq161fd/public_html/contactus/files/contactAssets/contactform.php on line 41 - [22-Jan-2020 20:28:14 UTC] PHP Notice: Undefined index:
compatibility in
/home/e5z2aaq161fd/public_html/contactus/files/contactAssets/contactform.php on line 43 - [22-Jan-2020 20:28:14 UTC] PHP Notice: Undefined index: autoreply
in
/home/e5z2aaq161fd/public_html/contactus/files/contactAssets/contactform.php on line 60 - [22-Jan-2020 20:28:14 UTC] PHP Notice: Undefined index:
autoreplysig in
/home/e5z2aaq161fd/public_html/contactus/files/contactAssets/contactform.php on line 62 - [22-Jan-2020 20:28:14 UTC] PHP Notice: Undefined index:
autosubject in
/home/e5z2aaq161fd/public_html/contactus/files/contactAssets/contactform.php on line 63