frank_solo Posted May 18, 2013 Share Posted May 18, 2013 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 https://forums.phpfreaks.com/topic/278136-captcha-code-does-not-work/ Share on other sites More sharing options...
mac_gyver Posted May 18, 2013 Share Posted May 18, 2013 what have you done to troubleshoot the problem? what does $_SESSION['security_code'] contain? Link to comment https://forums.phpfreaks.com/topic/278136-captcha-code-does-not-work/#findComment-1430861 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.