Ver Mensaje Individual
  #18 (permalink)  
Antiguo 18/06/2008, 09:51
theplanex
 
Fecha de Ingreso: junio-2008
Mensajes: 4
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: como activar un formulario

MIREN ESTE ES MI FORMULARIO AYUDENME PS APARTE DE ESO ME SALE ERROR EN LAS LINEAS 45 Y 46
A KE SE DEVE POR FABON UN EXPERTO EN ESTO KE ME AYUDE
<?
echo "<script type=\"text/javascript\">\n";
echo "<!--\n";
echo "function validar(form1) {\n";
echo "if (form1.name.value.length < 2) {\n";
echo "alert('";
echo "Inserte el nombre";;
echo "')\n";
echo "form1.name.focus();\n";
echo "return (false);}\n";
echo "var checkOK = \"ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ\" + \"abcdefghijklmnñopqrstuvwxyzáéíóú\";\n";
echo "var checkStr = form1.name.value;\n";
echo "var allValid = true;\n";
echo "var uword = hex_md5(document.getElementById('uword').value)\n" ;
echo "for (i = 0; i < checkStr.length; i++) {";
echo "ch = checkStr.charAt(i);\n";
echo "for (j = 0; j < checkOK.length; j++)\n";
echo "if (ch == checkOK.charAt(j))\n";
echo "break;\n";
echo "if (j == checkOK.length) {\n";
echo "allValid = false;\n";
echo "break;";
echo "}}\n";
echo "if (!allValid) {\n";
echo "alert('";
echo "inserte el nombre";
echo "');\n";
echo "form1.name.focus();\n";
echo "return (false);}\n";
echo "if ((form1.email.value.indexOf ('@', 0) == -1)||(form1.email.value.length < 9) ||

form1.email.value.indexOf ('.', 0)== -1 ){\n";
echo "alert('";
echo "inserte el email";
echo "');\n";
echo "form1.email.focus();";
echo "return (false);}\n";
echo "if (form1.message.value.length < 7) {\n";
echo "alert('";
echo "inserte el mensaje";
echo "');\n";
echo "form1.message.focus();";
echo "return (false);}\n";
echo "else {\n";
echo "-->\n";
echo "</script>\n";
?>
<style type="text/css">
<!--
img{border:0;}
-->
</style>
</head>
<body>

<form method="post" onsubmit="return validar(this)" id="form1" action="gracias.php">

<p><input type="hidden" name="token" value="<?=$token?>" /></p>
<p><input type="hidden" name="ip" value="<?=$_SERVER['REMOTE_ADDR']?>" /></p>
<p><input type="hidden" name="httpref" value="<?=$httprefe?>" /></p>
<p><input type="hidden" name="httpagent" value="<?=$httpagente?>" /></p>
<p><input type="hidden" name="date" value="<?=$datee?>" /></p>
<p>
Nombre:*<input name="name" type="text" value="" />
</p>
<p>
E-mail:* <input name="email" type="text" value="" />
</p>
<p>
Asunto: <input name="phone" type="text" value="" />
</p>
<p>
Mensaje:* <br />
<textarea name="message" cols="30" rows="5"></textarea>
</p>
<input type="submit" value="enviar" />
</p>
</form>
<p>campos con * son obligatorios.

</p>
</p>
</body>
</html>





y el envio es este

<?
if(eregi("MIME-Version:",$postVars)) {
mail("[email protected]"/*este es mi correo*/, "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(1, 1000).$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>gracias</title>
</head>
<body>
<?
$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']);

$_SESSION['token'] = $token;
$token = md5(rand(1, 1000).$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</p>


</body>
</html>

ayudenme a resolver el problema por fabor si fabor