Jump to content

Captcha Code


frank_solo

Recommended Posts

Can anyone please take a quick glance at this form the captcha messages are not appearing correctly. The message keeps getting sent.

 

Thank You

 

<?php
  if(($_SESSION['security_code'] != $_POST['security_code']) || (empty($_SESSION['security_code'])) ){


$to       = "info@*******.com"; // change to your email address
$name     = htmlentities ($_POST['name']);
$email    = htmlentities ($_POST['email']);
$phone    = htmlentities ($_POST['phone']);
$msg      = htmlentities ($_POST['msg']);
$d        = date('l dS \of F Y h:i:s A');
$sub      = "form to mail";
$headers  = "From: $name <$email>\n";  
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
$mes      = "phone: ".$phone."\n";
$mes     .= "Message: ".$msg."\n";
$mes     .= "Name: ".$name."\n";
$mes     .= 'Email: '.$email."\n";
$mes     .= 'Date & Time: '.$d;
{
     mail($to, $sub, $mes, $headers);

}
echo "<p> </p><p> </p><p> </p><br />CAPTCHA CODE does not match! <p> </p><p> </p><a href='javascript:javascript:history.go(-1)'>Click here to go back to previous page</a>";
  }
  else 
  echo "THANK YOU";
  

?>

Link to comment
Share on other sites

This line

if(($_SESSION['security_code'] != $_POST['security_code']) || (empty($_SESSION['security_code'])) ){

 

should be

if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ){

 

as this section of the code wants to send the message so it must comply to your if statement, you were saying if it does not equal the code or the code is empty send the message

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.