Results 1 to 5 of 5

Thread: Do-it-yourself Capcha - Need Help

  1. #1
    Join Date
    Sep 2010
    Posts
    11

    Default Do-it-yourself Capcha - Need Help

    Greetings!

    I have a HTML form of the https type (in a secure SSL area using decoder/encoder, etc.) that invokes the formmail.php upon clicking the SUBMIT button.

    On this form, just above the Submit button, I included another PHP file called capcha.php.

    Here is the capcha.php code:

    <?php

    session_start();

    $string = '';

    for ($i = 0; $i < 5; $i++) {
    $string .= chr(rand(97, 122));
    }

    $_SESSION['random_code'] = $string;

    $dir = 'fonts/';

    $image = imagecreatetruecolor(170, 60);
    $black = imagecolorallocate($image, 0, 0, 0);
    $color = imagecolorallocate($image, 200, 100, 90); //red
    $white = imagecolorallocate($image, 255, 255, 255);

    imagefilledrectangle($image,0,0,399,99,$white);
    imagettftext($image, 16, 12, 10, 40, $color, $dir."arial.ttf", $_SESSION['random_code']);

    header("Content-type: image/png");
    imagepng($image);

    ?>

    Currently, when I click on SUBMIT, the form runs the Formmail.php, the decoder, and emails me the coded form. Nothing new, since I have not included any code to qualify that the user has correctly entered the capsha code. (random_code).

    Why? Because that is about the limit of my experience. I do not know how to only invoke the formmail.php if the user enters the correct code.

    I would appreciate any help or direction in how this is interfaced with the formmail.php script.

    Thanks!
    Webbiz

  2. #2
    Join Date
    Sep 2010
    Posts
    3

    Default Re: Do-it-yourself Capcha - Need Help

    Not sure if this is helpful, but I added a ReCaptca yesterday and installed it using the how to on the tectite site and it worked perfectly. You may want to sign up for a ReCaptca account (free) and go that route.

  3. #3
    Join Date
    Sep 2010
    Posts
    11

    Default Re: Do-it-yourself Capcha - Need Help

    Thanks for the reply.

    I thought of that, but I really do not want to rely on a third-party. If their site gets too busy, it would hold up my form.

    Since my code already generates a random number and displays it graphically on my form, I figured it would not be too difficult to compare it to what the user enters. As I'm not strong in PHP, I don't want to mess up the Formmail.php that it currently calls.

    So I'm hoping someone can suggest how to do this where the Formmail.php is only called if the correct text is entered in my 'code' textbox when the Submit button is pressed.


  4. #4
    Join Date
    Mar 2004
    Posts
    2,224

    Default Re: Do-it-yourself Capcha - Need Help

    u can use $SESSION_ACCESS to let FormMail access ur "random_code" session value

    it then works just like any field submitted in the form - only it's secure coz its in the session

    then, create a "required" hidden field that compares the user's input to the "random_code" field.

    when that works, move the "required" into an INI file and u should be fine.

    no changes to FormMail (other than it's config section)

    it's a bit of work, but not too hard.

    (i haven't tried this but it should work)

    tectite's website contains all the doco u need regarding the above steps

    of course, u could just use tectite's free image verification (captcha) product - it lives on ur server so u aren't reliant on a 3rd party.

  5. #5
    Join Date
    Sep 2010
    Posts
    11

    Default Re: Do-it-yourself Capcha - Need Help

    Thanks Crabtree.

    I'll look into their free image verification (captcha) product and see if I can pull it off.

    All the best.

    Webbiz

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. browser failure on capcha (safari, chrome)
    By Gary in forum Community Support
    Replies: 4
    Last Post: 20-Aug-2010, 07:09 AM
  2. Capcha Error - Please Help
    By whfh99 in forum Community Support
    Replies: 7
    Last Post: 09-Dec-2009, 05:55 PM
  3. Capcha and 8.11 problem
    By tsrwebmaster in forum Bug Reports
    Replies: 1
    Last Post: 08-Dec-2008, 06:39 PM
  4. Problems: good/bad_url, capcha verification
    By jparker412 in forum Community Support
    Replies: 2
    Last Post: 25-Mar-2008, 06:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •