File: /home/c1190199/public_html/wp-content/themes/infocus/lib/includes/submit-widget.php
<?php
/**
* Contact Widget Form Submit
*/
//Check to see if the honeypot captcha field was filled in
if(trim($_POST['checking']) !== '') {
$captchaError = true;
} else {
//Check to make sure that the name field is not empty
if(trim($_POST['contactNameWidget']) === '') {
$nameError = 'Te olvidaste de ingresar el nombre!';
$hasError = true;
} else {
$name = trim($_POST['contactNameWidget']);
}
//Check to make sure sure that a valid email address is submitted
if(trim($_POST['emailWidget']) === '') {
$emailError = 'Ingresa tu email por favor.';
$hasError = true;
} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['emailWidget']))) {
$emailError = 'Ingresaste un email invalido.';
$hasError = true;
} else {
$email = trim($_POST['emailWidget']);
}
//Check to make sure comments were entered
if(trim($_POST['commentsWidget']) === '') {
$commentError = 'Ingresa un mensaje por favor.';
$hasError = true;
} else {
if(function_exists('stripslashes')) {
$comments = stripslashes(trim($_POST['commentsWidget']));
} else {
$comments = trim($_POST['commentsWidget']);
}
}
//If there is no error, send the email
if(!isset($hasError)) {
$emailTo = $_POST['emailAddressWidget'];
$subject = 'Solicitud enviada por '.$name;
$sendCopy = trim($_POST['sendCopy']);
$body = "Nombre: $name <br>Email: $email <br>Mensaje: $comments";
$headers = 'From: Demo Mode <'.$emailTo.'>' . "\r\n" .
'Content-type: text/html; charset=UTF-8' . "\r\n" .
'Reply-To: ' . $email;
mail($emailTo, $subject, $body, $headers);
if($sendCopy == true) {
$subject = 'You emailed Your Name';
$headers = 'From: Your Name <noreply@somedomain.com>';
mail($email, $subject, $body, $headers);
}
$emailSent = true;
}
}
?>