Foros del Web » Programando para Internet » PHP »

Formulario de contacto

Estas en el tema de Formulario de contacto en el foro de PHP en Foros del Web. Hola, le he puesto un captcha a mi formulario y no funciona, si me pueden ayudar a ver si esta correctamente escrito os lo agradeceria. ...
  #1 (permalink)  
Antiguo 22/11/2015, 04:43
 
Fecha de Ingreso: noviembre-2015
Mensajes: 3
Antigüedad: 8 años, 5 meses
Puntos: 0
Formulario de contacto

Hola, le he puesto un captcha a mi formulario y no funciona, si me pueden ayudar a ver si esta correctamente escrito os lo agradeceria.

En el index tengo lo siguiente:

<form method="post" id="contact_form" name="contact_form" class="big clearfix alt" action="inc/send.php" data-animation="fadeInDown slow" data-delay="0.6">
<div class="contact-onehalf fleft"><input type="text" name="name" placeholder="Name" class="name"></div>
<div class="contact-onehalf fRight"><input type="email" name="email" placeholder="Email" class="email"></div>
<div class="clear-2"><input type="url" name="website" placeholder="City" class="site"></div>
<div><textarea name="message" placeholder="Comment"></textarea></div>
<div><div class="g-recaptcha" data-sitekey="6Lc3iRATAAAAAMuuy6P5Kg_jX-6Mb-JwztIhIy64"></div></div>
<div class="spacer" style="height:12px;"></div>
<div class="buttons clearfix">
<button type="submit" class="button8 btn-1 send">Send Message</button>
</div>
</form>

en el send.php tengo lo siguiente
error_reporting(E_ALL ^ E_NOTICE);
$post = (!empty($_POST)) ? true : false;
if ($post)
{
$secret = '6Lc3iRATAAAAAMuITx6EJ-bx11pZmNilIp6-Ahv9';
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
$resp = $recaptcha->verify($gRecaptchaResponse, $remoteIp);

if ($resp->isSuccess()) {
$to = '[email protected]'; // insert your email for contacts form sending data
$subject = stripslashes($_POST['name']) . " juanma";
$name = stripslashes($_POST['name']);
if (!filter_var(trim($_POST['email']), FILTER_VALIDATE_EMAIL))
{
echo 'Your email address must be in the format of [email protected]';
exit();
}
$email = trim($_POST['email']);
$message = trim($_POST['message']);
$website = trim($_POST['website']);
$message = "<br>$message <br><br>";
$message.="---<br>Best regards,<br><strong>$name</strong>";
if ($website)
{
$message.="<br><a href='$website'>$website</a>";
}
$Reply = $email;
$from = $name;


// Let's send the email.

$headers = "from: $from <$Reply>\nReply-To: $Reply \nContent-type: text/html";

$mail = mail($to, $subject, $message, $headers);

if ($mail)
{
echo 'success';
}
else
{
echo 'Something going wrong with sending mail...';
}
}
}
else
{
echo 'You can not access it directly!';
}
?>

y en otra carpeta llamada src tengo todos los archivos del captcha.

Gracias de antemano.
  #2 (permalink)  
Antiguo 22/11/2015, 06:52
 
Fecha de Ingreso: noviembre-2003
Ubicación: Zaragoza, España
Mensajes: 1.257
Antigüedad: 20 años, 5 meses
Puntos: 154
Respuesta: Formulario de contacto

Hola juanunlin,

Imagino que tendrás que incluir los archivos necesarios del captcha indicando la ruta correcta.

Espero que con esto te aclares.
  #3 (permalink)  
Antiguo 24/11/2015, 14:16
 
Fecha de Ingreso: noviembre-2015
Mensajes: 3
Antigüedad: 8 años, 5 meses
Puntos: 0
Respuesta: Formulario de contacto

muchas gracias por la respuesta, si esta todos incluidos en la carpeta src, nose si tengo el php mal

es este
<?php
require('../src/autoload.php');
error_reporting(E_ALL ^ E_NOTICE);
$post = (!empty($_POST)) ? true : false;
if ($post)
{
$secret = '6Lc3iRATAAAAAMuITx6EJ-bx11pZmNilIp6-Ahv9';
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
$resp = $recaptcha->verify($gRecaptchaResponse, $remoteIp);

if ($resp->isSuccess()) {
$to = '[email protected]'; // insert your email for contacts form sending data
$subject = stripslashes($_POST['name']) . " Fono Acustica";
$name = stripslashes($_POST['name']);
if (!filter_var(trim($_POST['email']), FILTER_VALIDATE_EMAIL))
{
echo 'Your email address must be in the format of [email protected]';
exit();
}
$email = trim($_POST['email']);
$message = trim($_POST['message']);
$website = trim($_POST['city']);
$message = "<br>$message <br><br>";
$message.="---<br>Best regards,<br><strong>$name</strong>";
if ($website)
{
$message.="<br><a href='$website'>$website</a>";
}
$Reply = $email;
$from = $name;


// Let's send the email.

$headers = "from: $from <$Reply>\nReply-To: $Reply \nContent-type: text/html";

$mail = mail($to, $subject, $message, $headers);

if ($mail)
{
echo 'success';
}
else
{
echo 'Something going wrong with sending mail...';
}
}
}
else
{
echo 'You can not access it directly!';
}
?>

Etiquetas: contacto, formulario, html
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.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:55.