oscommerce

Simple captcha for oscommerce contact form

Embed 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['action']) && ($HTTP_GET_VARS['action&#039;] == 'send')) {

place the verification code:

        // Captcha check
    &nbsp;   $t = trim($HTTP_POST_VARS['verify']);
    &nbsp;   if ($t == "") {
    &nbsp;    &nbsp;    &nbsp; $captcha_error = "Enter the verification code!";
    &nbsp;    &nbsp;    &nbsp; $error = true;
    &nbsp;    &nbsp;    &nbsp; $messageStack->add('contact', $captcha_error);
    &nbsp;   } else if (trim($_SESSION["thecode&quot;]) == "") {
    &nbsp;    &nbsp;    &nbsp; $captcha_error = "No verification code generated!";
    &nbsp;    &nbsp;    &nbsp; $error = true;
    &nbsp;    &nbsp;    &nbsp; $messageStack->add('contact', $captcha_error);
    &nbsp;   } else if ($_SESSION["thecode"] != strtoupper($t)) {
    &nbsp;    &nbsp;    &nbsp; $captcha_error = "Invalid verification code!";
    &nbsp;    &nbsp;    &nbsp; $error = true;
    &nbsp;    &nbsp;    &nbsp; $messageStack->add('contact', $captcha_error);
    &nbsp;   }
    &nbsp;   else
    &nbsp;   { // End Captcha Check

Cloning oscommerce website for development

  1. Create dev.domain.tld site in hosting control panel.
  2. Create the database and user.
  3. Copy over the database and files.
  4. Update the database and user info in "includes/configure.php" and "admin/includes/configure.php".
  5. Also update the file paths in the configure.php files.
  6. Update the links to point to the development site:
    $ for x in `grep -r www.domain.tld * -l` ; do perl -pi \
      -e 's/www\.domain\.tld/dev\.domain\.tld/g' $x ; done
  7. Optionally disable SSL in "includes/configure.php".
  8. Change ownership of files as required.
  9. Login in as admin and change the cache location.
Comment