EL problema es que tengo un formulario que en Ie no me funciona el captcha de SUMA que es el ultimo paso requerido obligatorio. En otros navegadores va bien.
cundo se coloca la suma requerida en la ultima casilla salta el cartel de Error en la validacion suma, que teoricamente salta cuando la suma esta mal echa pero en Explorer salta igual
Que puede ser?
por favor gracias...
Código HTML:
<!-- fORMULARIO --> <div id="main-container"> <div id="form-container"> <h1 id="destinatario">Destinatario</h1> <p>Deci lo que quieras a un destinatario (Anonimo o c/Remitente)</p> <form id="contact-form" name="contact-form" method="post" action="submit.php"> <table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> <td width="15%"><label for="name">Nombre</label></td> <td width="70%"><input type="text" class="validate[required,custom[onlyLetter]]" name="name" id="name" value="<?=$_SESSION['post']['name']?>" /></td> <td width="15%" id="errOffset"> </td> </tr> <tr> <td><label for="email">Tu Email</label></td> <td><input type="text" class="validate[required,custom[email]]" name="email" id="email" value="<?=$_SESSION['post']['email']?>" /></td> <td> </td> </tr> <tr> <td><label for="email2">Email destinatario</label></td> <td><input type="text" class="validate[required,custom[email]]" name="email2" id="email" value="<?=$_SESSION['post']['email2']?>" /></td> <td> </td> </tr> <tr> <td><label for="subject">Modo de envio</label></td> <td><select name="subject" id="subject"> <option value="" selected="selected"> - Elegi una opcion -</option> <option value="Email anonimo">Email anonimo</option> <option value="Email con destinatario">Email con destinatario</option> </select> </td> <td> </td> </tr> <tr> <td valign="top"><label for="message">Mensaje</label></td> <td><textarea name="message" id="message" class="validate[required]" cols="35" rows="5"><?=$_SESSION['post']['message']?></textarea></td> <td valign="top"> </td> </tr> <tr> <td><label for="captcha"><?=$_SESSION['n1']?> + <?=$_SESSION['n2']?> =</label></td> <td><input type="text" class="validate[required,custom[onlyNumber]]" name="captcha" id="captcha" /></td> <td valign="top"> </td> </tr> <tr> <td valign="top"> </td> <td colspan="2"><input type="submit" name="button" id="button" value="Enviar" /> <input type="reset" name="button2" id="button2" value="Borrar" /> <?=$str?> <img id="loading" src="img/ajax-load.gif" width="16" height="16" alt="loading" /></td> </tr> </table> </form> <?=$success?> </div> </div> </div> <!-- END FORMULARIO -->
Código PHP:
<?php
/* config start */
$emailAddress = '[email protected]';
/* config end */
require "phpmailer/class.phpmailer.php";
session_name("fancyform");
session_start();
foreach($_POST as $k=>$v)
{
if(ini_get('magic_quotes_gpc'))
$_POST[$k]=stripslashes($_POST[$k]);
$_POST[$k]=htmlspecialchars(strip_tags($_POST[$k]));
}
$err = array();
if(!checkLen('name'))
$err[]='The name field is too short or empty!';
if(!checkLen('email'))
$err[]='The email field is too short or empty!';
else if(!checkEmail($_POST['email']))
$err[]='Your email is not valid!';
if(!checkLen('email2'))
$err[]='The email field is too short or empty!';
else if(!checkEmail($_POST['email2']))
$err[]='Your email is not valid!';
if(!checkLen('subject'))
$err[]='You have not selected a subject!';
if(!checkLen('message'))
$err[]='The message field is too short or empty!';
if((int)$_POST['captcha'] != $_SESSION['expect'])
$err[]='The captcha code is wrong!';
if(count($err))
{
if($_POST['ajax'])
{
echo '-1';
}
else if($_SERVER['HTTP_REFERER'])
{
$_SESSION['errStr'] = implode('<br />',$err);
$_SESSION['post']=$_POST;
header('Location: '.$_SERVER['HTTP_REFERER']);
}
exit;
}
$msg=
'Name: '.$_POST['name'].'<br />
Email remitente: '.$_POST['email'].'<br />
Email destinatario: '.$_POST['email2'].'<br />
Modo de envio: '.$_POST['subject'].'<br />
IP: '.$_SERVER['REMOTE_ADDR'].'<br /><br />
Message:<br /><br />
'.nl2br($_POST['message']).'
';
$mail = new PHPMailer();
$mail->IsMail();
$mail->AddReplyTo($_POST['email'], $_POST['name']);
$mail->AddAddress($emailAddress);
$mail->SetFrom($_POST['email'], $_POST['name']);
$mail->Subject = "Nuevo mensaje | NOMEANIMOADECIRLO";
$mail->MsgHTML($msg);
$mail->Send();
unset($_SESSION['post']);
if($_POST['ajax'])
{
echo '1';
}
else
{
$_SESSION['sent']=1;
if($_SERVER['HTTP_REFERER'])
header('Location: '.$_SERVER['HTTP_REFERER']);
exit;
}
function checkLen($str,$len=2)
{
return isset($_POST[$str]) && mb_strlen(strip_tags($_POST[$str]),"utf-8") > $len;
}
function checkEmail($str)
{
return preg_match("/^[\.A-z0-9_\-\+]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $str);
}
?>