Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/02/2016, 07:35
markplan
 
Fecha de Ingreso: agosto-2005
Mensajes: 125
Antigüedad: 18 años, 9 meses
Puntos: 0
Formulario de contacto PHP problemas

Tengo el siguiente codigo PHP que me funcionaba a la perfección, donde no me llegaba correos SPAM, y desde hace un mes atras, me llega correos SPAM.
No se ha colocado "captcha", para asegurar que mas personas nos contacten, lo cual fue asi, el codigo funcionaba perfectamente bien, y hace unos meses atras, ahora ya no. Me llega correos SPAM.

¿Cual será el problema? No logro encontrar algun hueco o desactualización del codigo de PHP o Java Script. Pero les dejo todo el codigo que utilizo.

Código PHP:
<!DOCTYPE html>
<html lang="es_ES">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<title>Titulo de la web</title>
</head>
<body>
<?php
if(isset($_POST['boton'])){
if(
$_POST['nombre'] == ''){
    
$error1 '<span class="error">Ingrese su nombre</span>';
}else if(
$_POST['email'] == '' or !preg_match("/^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/",$_POST['email'])){
    
$error2 '<span class="error">Ingrese un email correcto</span>';
}else if(
$_POST['mensaje'] == ''){
    
$error4 '<span class="error">Ingrese su consulta</span>';
}else{            
    
$dest "[email protected]";
    
$asunto "Pregunta sobre cotizacion";
    
$nombre $_POST['nombre'];
    
$email $_POST['email'];
    
$pais $_POST['pais'];
    
$ciudad $_POST['ciudad'];
    
$telefono $_POST['telefono'];
    
$mensaje $_POST['mensaje'];
    
$cuerpo '
<html> 
<head><title>Consulta sobre informe de ventas</title></head> 
<body> 
<h3><font color="#FF0000"><b>'
.$asunto.'</b></font></h3> 
<table width="50%">
<tr>
    <td width="93"><b>Nombres</b></td>
    <td width="369">'
.$nombre.'</td>
</tr>
<tr>
    <td><b>Ciudad</b></td>
    <td>'
.$ciudad.'</td>
</tr>
<tr>
    <td><b>Pais</b></td>
    <td>'
.$pais.'</td>
</tr>
  <tr>
    <td><b>Correo</b></td>
    <td>'
.$email.'</td>
</tr>
<tr>
    <td><b>Telefono</b></td>
    <td>'
.$telefono.'</td>
</tr>
<tr>
    <td height="21" colspan="2" valign="top"><b>CONSULTA ========================================</b></td>
</tr>
<tr>
    <td height="21" colspan="2" valign="top">'
.$mensaje.'</td>
</tr>
</table>
</body> 
</html>'
;
    
//Cabeceras del correo
    
$headers "From: $dest \r\n"//Quien envia?
    
$headers .= "Reply-To: $email \r\n";
    
$headers .= "X-Mailer: PHP5\n";
    
$headers .= 'MIME-Version: 1.0' "\n";
$headers .= 'Content-type: text/html; charset=utf-8' "\r\n";
if(
mail($dest,$asunto,$cuerpo,$headers)){
    
$result '<div class="resultado">Su mensaje fue enviado correctamente, gracias :)</div>';    
    
$_POST['nombre'] = '';
    
$_POST['email'] = '';
    
$_POST['pais'] = '';
    
$_POST['mensaje'] = '';
    
$_POST['ciudad'] = '';
    
$_POST['telefono'] = '';
    
$_POST['programa'] = '';
}else{
    
$result '<div class="result-fallo">Hubo un error al enviar el mensaje :(</div>';
        }
    }
}
?>

<form name="form1" id="ff" method="post" action="">
    <label>
    <span>Nombre y apellidos:</span><br />
    <?php echo $error1 ?>
    <input type="text" name="nombre" value="<?php echo $_POST["nombre"]; ?>" />
    </label>
    <label>
    <span>Su email:</span><br />
    <?php echo $error2 ?>
    <input name="email" type="text" value="<?php echo $_POST["email"]; ?>" />
    </label>
    <label><input name="pais" placeholder="País (Opcional)" type="text" value="<?php echo $_POST["pais"]; ?>" /></label>
    <label><input name="ciudad" placeholder="Ciudad (Opcional)" type="text" value="<?php echo $_POST["ciudad"]; ?>" /></label>
    <label><input name="telefono" placeholder="Teléfono (Opcional)" type="text" value="<?php echo $_POST["telefono"]; ?>" /></label>
    <label>
    <span>Su consulta:</span><br />
    <?php echo $error4 ?>
    <textarea  name="mensaje"><?php echo $_POST["mensaje"]; ?></textarea>
    </label>
    <center><input class="sendButton" name="boton" id="submit" value="Enviar" type="submit"></center>
    <center><?php echo $result?></center>
</form>


<script src="js/form.js"></script>
</body></html>
Este es mi codigo para bloquear contactos SPAM
Código:
$(function() { 
	var emailreg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;	
	$(".boton").click(function(){  
		$(".error").fadeOut().remove();
		
        if ($(".nombre").val() == "") {  
			$(".nombre").focus().after('<span class="error">Ingrese su nombre</span>');  
			return false;  
		}  
        if ($(".email").val() == "" || !emailreg.test($(".email").val())) {
			$(".email").focus().after('<span class="error">Ingrese un email correcto</span>');  
			return false;  
		}  
        if ($(".pais").val() == "") {  
			$(".pais").focus().after('<span class="error">Ingrese su pais</span>');  
			return false;  
		}  
        if ($(".mensaje").val() == "") {  
			$(".mensaje").focus().after('<span class="error">Ingrese un mensaje</span>');   
			return false;  
		}  
    });  
	$(".nombre, .pais, .mensaje").bind('blur keyup', function(){  
        if ($(this).val() != "") {  			
			$('.error').fadeOut();
			return false;  
		}  
	});	
	$(".email").bind('blur keyup', function(){  
        if ($(".email").val() != "" && emailreg.test($(".email").val())) {	
			$('.error').fadeOut();  
			return false;  
		}  
	});
});

Última edición por markplan; 02/02/2016 a las 07:44