#125_fehler_im_kontaktformular #126
@ -6,14 +6,13 @@ function sanitize_text(string $name, string $type) {
|
||||
'text' => FILTER_SANITIZE_SPECIAL_CHARS,
|
||||
'email' => FILTER_SANITIZE_EMAIL,
|
||||
);
|
||||
$text = trim($text);
|
||||
$text = filter_var($_POST[$name], $filters[$type]);
|
||||
$text = filter_var(trim($_POST[$name]), $filters[$type]);
|
||||
$text = stripslashes($text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
function prepare_message_body($message) {
|
||||
function prepare_message_body(string $message, string $name) {
|
||||
// Replace HTML-Entities with actual carriage returns and line feeds
|
||||
$message = str_replace(" ", "\r", $message);
|
||||
$message = str_replace(" ", "\n", $message);
|
||||
@ -38,7 +37,7 @@ function send_message_to_office($subject, $message, $name, $email) {
|
||||
return mail(
|
||||
getenv('WTF_CONTACT_TO'),
|
||||
"=?UTF-8?B?" . base64_encode($subject) . "?=",
|
||||
prepare_message_body($message),
|
||||
prepare_message_body($message, $name),
|
||||
$additional_headers = array(
|
||||
"From" => getenv('WTF_CONTACT_FROM'),
|
||||
"Reply-To" => $email,
|
||||
|
Loading…
Reference in New Issue
Block a user