Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/07/2003, 21:18
kech
 
Fecha de Ingreso: marzo-2003
Mensajes: 277
Antigüedad: 21 años, 11 meses
Puntos: 0
los problemas que tiene el script son estos

$mensaje = str_replace('\"',""",$mensaje);
$mensaje = str_replace("'","'",$mensaje);
$mensaje = str_replace("'","'",$mensaje);

pero realmente no entiendo para que tenerlos ya que el mensaje despues lo pasa por

$mensaje = htmlentities($mensaje);

que lo hace mucho mejor que como lo tenia arriba

y ademas de que no vas a meterlo en una bd para que importara sacar las comillas y los simbolos que pueden afectar en la consulta a la bd

pero hay ya funciona
salu2

Código PHP:
<?php

// Maileame v1.0 by Ignacio Sarmiento.
// [email][email protected][/email]
// [url]http://www.zonamaster.com[/url]


//E-mail en donde se recibirá el Formulario.

$recipiente "[email protected]";

//Pagina a donde se redireccionará una vez enviado.

$redireccionar "index.php";

//Mensaje que te llegará al Correo, con los datos ingresados.

$msg "El Sr/Srta $nombre, envia el formulario con los siguientes datos:\n\n\n

Nombre: $nombre
Email: $email
Web: $web
Pais: $pais
Asunto: $asunto
Mensaje:

$mensaje\n\n"
;

//Comprobamos que los campos del formulario se encuentren completos.

if (empty($nombre)){
echo 
"<p align=center><font face=tahoma size=2><b><font color=#FF0000>Error:</font> No has
ingresado tu Nombre.</b></font></p>"
;
}
if(empty(
$email)){
echo 
"<p align=center><font face=tahoma size=2><b><font color=#FF0000>Error:</font> No has
ingresado tu E-mail.</b></font></p>"
;
}
if(empty(
$pais)){
echo 
"<p align=center><font face=tahoma size=2><b><font color=#FF0000>Error:</font> No has
ingresado tu Pais.</b></font></p>"
;
}
if(empty(
$asunto)){
echo 
"<p align=center><font face=tahoma size=2><b><font color=#FF0000>Error:</font> No has
seleccionado un Asunto.</b></font></p>"
;
}
if(empty(
$mensaje)){
echo 
"<p align=center><font face=tahoma size=2><b><font color=#FF0000>Error:</font> No has
ingresado el Mensaje.</b></font></p>"
;
}

else{

//Limpiamos de posibles ataques.

$mensaje ereg_replace("\r\n","<br>"$mensaje);

$nombre htmlentities($nombre);
$email htmlentities($email);
$pais htmlentities($pais);
$mensaje htmlentities($mensaje);

//Enviamos el E-mail con todos los datos.

mail("$recipiente""$asunto""$msg""FROM: $email");

//Damos las gracias al visitante por contactarnos.

echo "<font face=tahoma size=2>
<p align=\"center\">Gracias</p>
<p align=\"center\">Responderemos tu mensaje en un plazo de 24 horas.<br><br>
<br>
<br>
<br>
<br>
</p>
<p align=center><br>
<a href=$redireccionar>Si no redirecciona en unos segundos, haz click aquí</a>.</p>"
;
}
?>

y este de

maileame.php

<form method="POST" action="enviado.php">

<head>
<title></title>
</head>

<body bgcolor="#C0C0C0">

<p align="center"><b><u><font size="1" face="Verdana" color="#000000">Formulario
de Contacto</font></u></b></p>
<div align="center">
<center>
<table border="0" width="51%" cellspacing="0" cellpadding="0" height="223">
<tr>
<td width="100%" bgcolor="#000000" height="223">
<table border="0" width="100%" cellspacing="1" cellpadding="0" height="103">
<tr>
<td width="50%" bgcolor="#CC3300" height="25">
<p align="right"><font color="#ffffff" size="1" face="Verdana"><b>Nombre:  </b></font></td>
<td width="50%" bgcolor="#CC3300" height="25"> <input type="text" name="nombre" size="20" style="background-color: #FFFFFF; color: #000000; border: 1 solid #000000"></td>
</tr>
<tr>
<td width="50%" bgcolor="#CC3300" height="25">
<p align="right"><font color="#ffffff" size="1" face="Verdana"><b>E-mail:  </b></font></td>
<td width="50%" bgcolor="#CC3300" height="25"> <input type="text" name="email" size="20" style="background-color: #FFFFFF; color: #000000; border: 1 solid #000000"></td>
</tr>
<tr>
<td width="50%" bgcolor="#CC3300" height="25">
<p align="right"><font color="#ffffff" size="1" face="Verdana"><b>Sitio
Web:  </b></font></td>
<td width="50%" bgcolor="#CC3300" height="25"> <input type="text" name="pais" size="20" style="background-color: #FFFFFF; color: #000000; border: 1 solid #000000" value="http://"></td>
</tr>
<tr>
<td width="50%" bgcolor="#CC3300" height="25">
<p align="right"><font color="#ffffff" size="1" face="Verdana"><b>Pais:  </b></font></td>
<td width="50%" bgcolor="#CC3300" height="25"> <input type="text" name="pais" size="20" style="background-color: #FFFFFF; color: #000000; border: 1 solid #000000"></td>
</tr>
<tr>
<td width="50%" bgcolor="#CC3300" height="25">
<p align="right"><font color="#ffffff" size="1" face="Verdana"><b>Asunto:  </b></font></td>
<td width="50%" bgcolor="#CC3300" height="25"> <select size="1" name="asunto" style="background-color: #FFFFFF; color: #000000; border: 1 solid #000000">
<option selected>Seleccione</option>
<option>Pregunta</option>
<option>Reclamo</option>
<option>Felicitaciones</option>
<option>Errores / Links
Rotos</option>
<option>Webmaster</option>
</select></td>
</tr>
<tr>
<td width="50%" bgcolor="#CC3300" height="56">
<p align="right"><font color="#ffffff" size="1" face="Verdana"><b>Mensaje:  </b></font></td>
<td width="50%" bgcolor="#CC3300" height="56"> <textarea rows="5" name="mensaje" cols="25" style="background-color: #FFFFFF; color: #000000; border: 1 solid #000000"></textarea></td>
</tr>
<tr>
<td width="50%" bgcolor="#CC3300" height="43"> </td>
<td width="50%" bgcolor="#CC3300" height="43">
<input type="submit" value="Enviar" name="enviar" style="background-color: #FFFFFF; color: #000000; border: 1 solid #000000">
<input type="reset" value="Borrar" name="borrar" style="background-color: #FFFFFF; color: #000000; border: 1 solid #000000"></td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</div>
</form>