commentsubmit: improve validation

This commit is contained in:
Jesús 2020-01-23 14:51:06 -05:00
parent c1c78252a5
commit ab2be3eab0
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766

View File

@ -52,13 +52,18 @@ if(empty($_POST['name']) ||
// Create the email and send the message // Create the email and send the message
// Add your email address // Add your email address
$to = 'heckyel@riseup.net'; $recipients = array(
"heckyel@riseup.net",
"$email_address",
// more emails
);
$to = implode(',', $recipients);
$email_subject = <<<EOT $email_subject = <<<EOT
[conocimientoslibres.tuxfamily.org] Mensaje de {$name} [conocimientoslibres.tuxfamily.org] Mensaje de {$name}
EOT; EOT;
$email_body = <<<EOT $email_body = <<<EOT
Haz recibido un nuevo comentario del formulario de tu sitio web. Nuevo comentario del formulario de conocimientoslibres.tuxfamily.org
Aqui estan los detalles:\n Aqui estan los detalles:\n
post_id: {$postID} post_id: {$postID}
Author: {$name} Author: {$name}
@ -66,12 +71,13 @@ Date: {$publish}
Email: {$email_address} Email: {$email_address}
Slug: {$slug} Slug: {$slug}
{$web}\n {$web}\n
{$comment} {$comment}\n\n
¿Usted no ha escrito este comentario? escríbenos a: heckyel[at]hyperbola[dot]info
EOT; EOT;
$headers = "From: noreply@conocimientoslibres.tuxfamily.org\n"; // Using something like noreply@yourdomain.com. $headers = "From: noreply@conocimientoslibres.tuxfamily.org\n"; // Using something like noreply@yourdomain.com.
$headers .= "Reply-To: $email_address"; $headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers); mail($to,$email_subject,utf8_decode($email_body),$headers);
// Rediret to current post // Rediret to current post
header("Refresh: 10; URL={$return_url}"); header("Refresh: 10; URL={$return_url}");