Simple captcha for oscommerce contact form
Thu, 07/24/2008 - 21:52 — sandipEmbed the captcha image by calling a php script in "contact_us.php":
<input type="text" name="verify" />
<img src="/image.php" width="60" height="20" alt="Please enter the values from this image" />
Edit contact_us.php file and exactly after the below line:
if (isset($HTTP_GET_VARS['ac tion']) && ($HTTP_GET_VARS['action 039;] == 'send')) {
place the verification code:
// Captcha check
&nbs p; $t = trim($HTTP_POST_VARS['ver ify']);
&nbs p; if ($t == "") {
&nbs p; &nbs p; &nbs p; $captcha_error = "Enter the verification code!";
&nbs p; &nbs p; &nbs p; $error = true;
&nbs p; &nbs p; &nbs p; $messageStack->add('co ntact', $captcha_error);
&nbs p; } else if (trim($_SESSION["thecode& quot;]) == "") {
&nbs p; &nbs p; &nbs p; $captcha_error = "No verification code generated!";
&nbs p; &nbs p; &nbs p; $error = true;
&nbs p; &nbs p; &nbs p; $messageStack->add('co ntact', $captcha_error);
&nbs p; } else if ($_SESSION["thecode" ] != strtoupper($t)) {
&nbs p; &nbs p; &nbs p; $captcha_error = "Invalid verification code!";
&nbs p; &nbs p; &nbs p; $error = true;
&nbs p; &nbs p; &nbs p; $messageStack->add('co ntact', $captcha_error);
&nbs p; }
&nbs p; else
&nbs p; { // End Captcha Check