8 Replies Latest reply on Feb 24, 2008 11:39 AM by Günter Schenk

    Problems with CAPTCHA

      HEEEEEEEEEELLLLLLLLLLLLLLLLLLLLLLPPPPPPPPPPPPP
      I'm having a problem with the captcha function in Developer Toolbox. First problem I had was my server wasn't displaying the image. So I renamed _temp folder to temp and .captcha to captcha. Now the image displays just fine. My next problem is even if I enter the correct characters it's still telling me that they are wrong. I'm currently on IPOWER's server. It's a Debian? Linux based server. Here is the error I'm getting.

      Error:
      Please enter the correct characters.
      tNG Execution Trace - VIEW

      tNG_insert.executeTransaction
      STARTER.Trigger_Default_Starter
      tNG_insert.doTransaction
      BEFORE.Trigger_Default_FormValidation
      BEFORE.CheckCaptcha* ~~~~~~~~This is showing up as red text.
      ERROR.Trigger_Default_Insert_RollBack
      tNG_insert.getRecordset
      tNG_insert.getFakeRsArr
      tNG_insert.getLocalRecordset
      tNG_insert.getFakeRecordset
      tNG_insert.getFakeRecordset
        • 1. Re: Problems with CAPTCHA
          Günter Schenk Level 4
          Hi Bill,

          did you already adapt your changes in the file "includes/common/lib/captcha/KT_Captcha.config.php" ? If not, this seems a required step, because the values of the two configuration variables in here (e.g. KT_CAPTCHA_TEMP_FOLDER) are getting "read" in numerous places in the file "KT_CaptchaImage.class.php", and that´s why it probably breaks

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Problems with CAPTCHA
            Level 1
            Gunter,

            Yes I made the corresponding changes to the KT_Captcha.config.php

            define('KT_CAPTCHA_TEMP_FOLDER', dirname(__FILE__).'/../../temp/captcha/');
            define('KT_CAPTCHA_TEMP_URL', 'includes/common/temp/captcha/');

            I also made sure that the folders in question were both read/writable to all users. I've tried to google the problem and there was no useable answers. I'm using the captcha in a simple "insert record" form created by Developer toolbox as well. Could there be some other place that I may have to change some settings in order for it to work properly?
            • 3. Re: Problems with CAPTCHA
              Günter Schenk Level 4
              Hi Bill,

              --------
              Could there be some other place that I may have to change some settings in order for it to work properly?
              --------

              sorry, I can´t be of help, and I also found no related hints on the Interakt forums -- maybe you´d better open a support incident with Adobe to get this sorted out.

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: Problems with CAPTCHA
                Level 1
                I completely redid the form and had to make other adjustments, so far everything works fine.
                I do have another question though. I want to change the font size of the captcha. I know that it uses ImageMagick because I replaced the standard Myriad Web Pro font with Book Antiqua and the change went through and displays book antiqua. I change part of the code inside the KT_CaptchaImage.class.php under imagemagick portion of it...

                ######Code#######
                $arrArguments = array(
                '-font',
                $fontFileName,
                '-pointsize',
                '34',
                ######End Code######

                I changed the 34 to several different sizes 36, 48, 72, yet none have seemed to work. Any help would be great.
                Thank you.
                • 5. Re: Problems with CAPTCHA
                  Level 1
                  I'm going to answer my own question here. I found that in line 102 of KT_CaptchaImage.class.php there's a code that looks like this..

                  #####CODE#####

                  $okttf = @imagettftext($im, 14, rand(-25, 25), 10+$i*$wFont, $hFont+rand(4, 26), $text_color, $fontFileName, $string[$i]);

                  #####END CODE#####

                  The "14" is the actual font size that is used. You can change this to what ever size you would like. Keeping in mind the amount of characters you're using as well as the actual image size, to make sure it fits.
                  • 6. Re: Problems with CAPTCHA
                    Günter Schenk Level 4
                    Hi Bill,

                    thanks for sharing this detection :-)

                    yeah, some code in this file is for imagemagick, other parts are for GD, and some stuff is of generic purpose -- what I once found out, is that...

                    ---------
                    @imagettftext($im, 14, rand( -25, 25)
                    ---------

                    ...will affect the random rotation angle of the displayed chars, so if you set it to e.g. rand(-1,1) you´ll practically have no rotation at all, what can improve the readability for human beings ;-) This example will affect GD only

                    Some other generic settings can be modified in the function getRandomText() located at the very end of this file:

                    -------
                    $letters = 'abcdefhjkmnpqrstuvwxyz2345678';
                    -------

                    guess it´s obvious that one can e.g. simply delete the numbers in order to make the Captcha display a-z.

                    Another cool option for actually controlling the number of displayed chars, is the line:

                    --------
                    $_SESSION[$this->name] = substr($str, 0, rand( 5,8));
                    --------

                    this default setting will randomly display 5 to 8 chars, so one just would need to change it to e.g. rand(3,5) for displaying 3 to 5 chars.

                    Cheers,
                    Günter Schenk
                    Adobe Community Expert, Dreamweaver
                    • 7. Re: Problems with CAPTCHA
                      Where would you put:

                      $_SESSION[$this->name] = substr($str, 0, rand(5,8));

                      Are you talking about updating the tNG_Captcha.class.php file at line 55?

                      $_SESSION[$this->name] = substr(md5(uniqid(rand(),true)), 0, rand(4,6));

                      I would rather not have to update the library code.
                      • 8. Re: Problems with CAPTCHA
                        Günter Schenk Level 4
                        Hi Angel,

                        -----
                        Are you talking about updating the tNG_Captcha.class.php file at line 55?
                        -----

                        no,

                        $_SESSION[$this->name] = substr($str, 0, rand(4,8));

                        is at line 232 of KT_CaptchaImage.class.php

                        -----
                        I would rather not have to update the library code
                        -----

                        if you need this functionality, I don´t see any other way than to modify this file

                        Cheers,
                        Günter Schenk
                        Adobe Community Expert, Dreamweaver