Jump to content

Captcha Code does not work


frank_solo

Recommended Posts

I'm having a problem with captcha code. I keep getting the echo message "CAPTCHA CODE does not match!" everytime I send it . What am I not seeing? Please open my eyes to the error. Thanks in advance.

<?php
session_start();

include "config.php";
$id = (int)$_GET['id'];
$res = mysql_query($query, $bd);
$id = (int)$_GET['id'];
$id = substr($id, 0,5);
if($id < 1 || $id > 99999) exit;
$query = "SELECT * FROM `units` WHERE `id` = $id";
$res = mysql_query($query, $bd);
$result = mysql_fetch_assoc($res);
$contact = $result['contact'];
$phone = $result['phone'];
 
$var = $result['email'];
if (!empty($var)) {

if (isset($_POST['submit'])) {

if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
$to       = "$var"; // 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      = "My Domain RE:".$result['title']."";
$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 "<div align='left'<span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #F00;'>Email Has Been Sent</span></div>";
} else {

echo "<div align='left'<span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #F00;'>CAPTCHA CODE does not match! </span></div>";

}

} 
echo "<div align='left'><span style='font-family: Tahoma, Geneva, sans-serif; font-size: 14px; color: #00F;'>Email: ".$result['contact']."</span></div>
<form method='post' action='apt.php?id=$id' name='contact''>
<input name='name' type='text' size='40' placeholder='Name'/><br>
<input name='email' type='text' size='40' placeholder='Email'/><br>
<input name='phone' type='text' size='40' placeholder='Phone'/><br>
<textarea name='msg' cols='29' rows='4'></textarea><br>
<div align='left'><img src='http://www.mydomain.co/CaptchaSecurityImages.php?width=100&height=40& characters=5' alt='captcha' width='75px'/><br><input name='security_code' type='text' id='security_code' /><input type='submit' value='Send' class='button' name='submit' /></div>
</form><br><br><br>";}
?>
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.