Foros del Web » Programando para Internet » PHP »

Php contacto error

Estas en el tema de Php contacto error en el foro de PHP en Foros del Web. me enviar correo CONTACTO PHP nunca???? Warning: preg_replace() [function.preg-replace]: Empty regular expression in /home/camilo19/public_html/gracias.php on line 44 Warning: preg_replace() [function.preg-replace]: Empty regular expression in /home/camilo19/public_html/gracias.php ...
  #1 (permalink)  
Antiguo 24/06/2009, 05:21
Avatar de camilo_1987  
Fecha de Ingreso: junio-2008
Ubicación: ALZIRA, Spain, Spain
Mensajes: 77
Antigüedad: 15 años, 10 meses
Puntos: 0
Php contacto error

me enviar correo CONTACTO PHP nunca????

Warning: preg_replace() [function.preg-replace]: Empty regular expression in /home/camilo19/public_html/gracias.php on line 44

Warning: preg_replace() [function.preg-replace]: Empty regular expression in /home/camilo19/public_html/gracias.php on line 45

Código PHP:
<?
  
@import_request_variables("gpc");
    
$youremail "[email protected]"//YOUR MAIL HERE 
    
$subject "RS candemasjor web "// TITLE OF DE SUBJECT IN MAIL
    
$redirect "contacto.php";//URL TO BE REDIRECTED IN 5 SECONDS
    
$secs "5";// TIME TO BE REDIRECTED

if(eregi("MIME-Version:",$postVars)) {
mail("[email protected]"/*YOUR MAIL HERE*/"Form Hijack Attempt""A spam relay was attempted from the Web site and was blocked.""From:SpamMonitor");
die();
//BLOCKING spam


 
$secret 'ssshhitsasecret';  
    
$token md5(rand(11000).$secret);
    
$_SESSION['token'] = $token;
    
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" >
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=iso-8859-1" />
<title>ejemplo de procesador de formulario web seguro antispam con captcha quinti.net</title>  
<meta http-equiv="refresh" content="<?=$secs;?>;URL=<?=$redirect;?>" />
 </head>
        <body> 
<?
  
//a partir de aquí hay una serie de variables que impiden que los spammers usen nuestro formulario como lanzadera de su spam 
  
$name stripslashes($name);
  
$message stripslashes($message);
  
$headers .= "From: " $email "\r\n\r\n"
    
//This is where the email is sent using your values from above. Be sure to update this if you change any fields in contact.php
    
mail("$youremail""$subject","
    Name: $name
    Email: $email
    Subject: $phone
    Message: $message 
    IP: $ip
    Browser Info: $httpagent
    Referral : $httpref
    Date : $date
"
,$headers);
   
// Strip \r and \n from the email address
   
$_POST['email'] = preg_replace("\r"""$_POST['email']);
   
$_POST['email'] = preg_replace("\n"""$_POST['email']);

//*****COMMENT: if you have problems with the lines 40/41, replace these for:
//$_POST['email'] = str_replace("\r", "", $_POST['email']);
//$_POST['email'] = str_replace("\n", "", $_POST['email']);//*****

   
$_SESSION['token'] = $token
   
$token md5(rand(11000).$secret);
   
$secret 'ssshhitsasecret';
   
$field preg_replace"/[\n\r]+/"" "$field );
    
// Remove injected headers
    
$find = array("/bcc\:/i","/Content\-Type\:/i","/cc\:/i","/to\:/i");
    
$_POST['email'] = preg_replace($find""$_POST['email']);
    
$message preg_replace($find""message); 
    
$email=str_replace("\r","\n",$email);
    
$name=str_replace("\r","\n",$name);
    
$message=str_replace("\r","\n",$message);
    
$phone=str_replace("\r","\n",$phone);
   
   
if(!
eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$email)) {
ob_clean();
mail("$youremail""Message Killed""$message""From: $name <$email>");
exit(
"Message killed.");
}
 if (
eregi('^(bcc$|content-type|mime-version|--)',$key))
print_error("Field names indicate exploit.");  //BLOCKING SPAM

?>
 <p>Gracias, el formulario se ha enviado con éxito, le contestaremos en menos de 24 h. En 5 segundos será redirigido a la página principal.</p>


        </body>
        </html>
  #2 (permalink)  
Antiguo 24/06/2009, 05:41
Avatar de Triby
Mod on free time
 
Fecha de Ingreso: agosto-2008
Ubicación: $MX->Gto['León'];
Mensajes: 10.106
Antigüedad: 15 años, 8 meses
Puntos: 2237
Respuesta: Php contacto error

La solucion la tienes integrada en tu codigo:

Código php:
Ver original
  1. // Strip \r and \n from the email address
  2.    $_POST['email'] = preg_replace("\r", "", $_POST['email']);
  3.    $_POST['email'] = preg_replace("\n", "", $_POST['email']);
  4.  
  5. //*****COMMENT: if you have problems with the lines 40/41, replace these for:
  6. //$_POST['email'] = str_replace("\r", "", $_POST['email']);
  7. //$_POST['email'] = str_replace("\n", "", $_POST['email']);//*****

Traduccion de: COMMENT: if you have problems with the lines 40/41, replace these for:
Si tienes problemas con las lineas 40/41, reemplazalas por:

En tu caso son las lineas 44 y 45, solo cambia preg_replace por str_replace y listo.
__________________
- León, Guanajuato
- GV-Foto
  #3 (permalink)  
Antiguo 24/06/2009, 06:08
Avatar de camilo_1987  
Fecha de Ingreso: junio-2008
Ubicación: ALZIRA, Spain, Spain
Mensajes: 77
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: Php contacto error

Código PHP:
 // Strip \r and \n from the email address

$_POST['email'] = str_replace("\r"""$_POST['email']);
$_POST['email'] = str_replace("\n"""$_POST['email']); 
el gente enviar contacto mi correo error porque?
  #4 (permalink)  
Antiguo 24/06/2009, 06:35
Avatar de Triby
Mod on free time
 
Fecha de Ingreso: agosto-2008
Ubicación: $MX->Gto['León'];
Mensajes: 10.106
Antigüedad: 15 años, 8 meses
Puntos: 2237
Respuesta: Php contacto error

No entiendo exactamente lo que dices, pero si estas recibiendo un mensaje de error por favor muestralo.
__________________
- León, Guanajuato
- GV-Foto
  #5 (permalink)  
Antiguo 24/06/2009, 06:43
Avatar de camilo_1987  
Fecha de Ingreso: junio-2008
Ubicación: ALZIRA, Spain, Spain
Mensajes: 77
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: Php contacto error

si entiendo mi web pagina contacto mensaje despues enviar correo *************, yo ver correo hay no band entrada, anti-spam eso?

Última edición por jam1138; 24/06/2009 a las 11:18
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Tema Cerrado




La zona horaria es GMT -6. Ahora son las 11:15.