A ver si así se ve un poco más claro el error:
Código PHP:
Ver original<?php
###### No edites este archivo ######
require "config.php";
# RegisterGlobals OFF
$f_name = $_POST['f_name'];
$f_mail = $_POST['f_mail'];$f_Edad = $_POST['f_Edad'];
$poblacion = $_POST['poblacion'];
$f_message = $_POST['f_message'];
$rs = $_POST['rs'];
$op = $_POST['op'];
}
# comprobamos que el formulario no esté vacío
if ($f_name <> "" and
$f_mail <> ""and
$f_Edad <> "" and
$poblacion <> "" and
$f_message <> "" and
$rs <> "" and
(ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$",$f_mail))) {
// First, make sure the form was posted from a browser.
// For basic web-forms, we don't care about anything
// other than requests from a browser:
if(!isset($_SERVER['HTTP_USER_AGENT'])){ die("Acceso no autorizado"); }
// Make sure the form was indeed POST'ed:
// (requires your html form to use: action="post")
if(!$_SERVER['REQUEST_METHOD'] == "POST"){
die("Acceso no autorizado"); }
// Where have we been posted from?
// Test to see if the $fromArray used www to get here.
$wwwUsed = strpos($fromArray['host'], "www.");
// Make sure the form was posted from an approved host name.
if(!in_array(($wwwUsed === false ?
$fromArray['host'] : substr(stristr($fromArray['host'], '.'), 1)), $authHosts)){ die("Acceso no autorizado"); }
// Pregunta antispam
if ($pregunta) {
if ($rs != $respuesta) { die ("<em>¿Seguro que la respuesta es correcta? Vuelve atrás en tu navegador</em>");exit; } }
// Attempt to defend against header injections:
$badStrings = array("Content-Type:", "MIME-Version:",
"Content-Transfer-Encoding:",
"bcc:",
"Bcc:",
"BCC:",
"cc:",
"Cc:",
"CC:");
// Loop through each POST'ed value and test if it contains
// one of the $badStrings:
foreach($_POST as $k => $v){
foreach($badStrings as $v2){
if(strpos($v, $v2) !== false){ die("Acceso no autorizado"); }
}
}
// Made it past spammer test, free up some memory
// and continue rest of script:
unset($k, $v, $v2, $badStrings, $authHosts, $fromArray, $wwwUsed);
//contenido
$informacion .= "\n\n------ información ------\n";
$informacion .= "REMOTE HOST: ".$_SERVER['REMOTE_HOST']."\n";
$informacion .= "REMOTE ADDR: ".$_SERVER['REMOTE_ADDR']."\n";
$informacion .= "HTTP_X_FORWARDED_FOR: ".$_SERVER['HTTP_X_FORWARDED_FOR']."\n";
$informacion .= "HTTP_CLIENT_IP: ".$_SERVER['HTTP_CLIENT_IP']."\n";
$informacion .= "NAVEGADOR: ".$_SERVER['HTTP_USER_AGENT']."\n";
$contenido = "$f_message
$informacion
";
mail("$email", "$prefijo $", "$contenido", "From: $f_name <$f_mail>"); echo "<em>Tu mensaje ha sido enviado. En breve nos pondremos en contacto contigo, gracias.</em>";
}
else {
if ($op<>"") { echo "<em>¡Ups! Es necesario rellenar correctamente todos los campos, gracias.</em>"; }
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<div align="center">
<table>
<tr>
<td width="19" height="43" align="right" bgcolor="#999999"> </td>
<td width="745" align="left" bgcolor="#999999"><strong>Nombre y Apellidos</strong>
<input name="f_name" type="text" value="<?php echo $f_name; ?>" size="60" /></td>
</tr>
<tr>
<td height="38" align="right" bgcolor="#999999"> </td>
<td align="left" bgcolor="#999999"><strong>E-mail</strong>
<input name="f_mail" type="text" value="<?php echo $f_mail; ?>" size="30" />
<strong> Edad </strong> <input name="f_Edad" type="text" value="<?php echo $f_Edad; ?>" size="10" /></td>
</tr>
<tr>
<td height="37" align="right" bgcolor="#999999"> </td>
<td align="left" bgcolor="#999999"><strong>Población</strong> <input name="poblacion" type="text" value="<?php echo $poblacion; ?>" size="30" /></td>
</tr>
<tr>
<td height="243" align="right" bgcolor="#999999"> </td>
<td align="left" bgcolor="#999999"><strong>Consulta</strong>
<p>
<textarea cols="80" rows="10" name="f_message"><?php echo $f_message; ?></textarea>
</p></td>
</tr>
<?php if ($pregunta) { ?>
<tr>
<td colspan="2" align="left" bgcolor="#999999"><?php echo $pregunta; ?> <input name="rs" type="text" value="" size="10" maxlength="10" /></td>
</tr>
<?php } else {echo "<input type='hidden' name='rs' value='rs' />";} ?>
</table>
<input type="hidden" name="op" value="ds" />
<input type="submit" value="Enviar consulta" />
</div>
</form>
<?php
}
?>