3 Replies Latest reply on Aug 20, 2007 5:54 AM by (itsadrian)

    How to limit captcha characters ?

      How can I manually limit the characters in the captcha extension to 4 characters for example?

      thanks for helping me!

      adrian
        • 1. Re: How to limit captcha characters ?
          Günter Schenk Level 4
          Hi Adrian,

          I reckon you´d have to edit the file "includes/common/lib/captcha/KT_CaptchaImage.class.php", as all the "logic" is implemented here.

          However, when opening this file, you´ll see the number "8" (8 chars obviously) declared all over the place, and I myself wouldn´t dare to change that because there´s way too much opportunity to possibly wreck havoc :-)

          The only thing I did find out now :: how to minimize the default captcha char rotation angle in order to make it notably more readable. Maybe you could try that instead ? Let me know if this is of interest to you...

          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: How to limit captcha characters ?
            Günter Schenk Level 4
            Hi Adrian,

            well I think I succeeded changing the char limit to, say, 4 :: at the bottom of the mentioned "KT_CaptchaImage.class.php" file you´ll see a function named "getRandomText" -- and in here there´s a line saying:

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

            When changing the "random, between 5 and 8" values (to, say, (5,7)) and reloading the page containing the captcha, the number of displayed chars changed as well, means I got between 5 and 7 chars, but never 8 as before.

            In order to change it to *exactly* 4 chars, just use (4,4) here. You might as well do away with the "rand" function then, but that´s another story -- however, it works for me !

            Günter Schenk
            Adobe Community Expert, Dreamweaver
            • 3. Re: How to limit captcha characters ?
              Level 1
              Hey Günter

              You are really an expert! It works fine your sugguestion:

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

              Thanks a lot for this very fast answer!!!
              (faster that the former interakt team did)!

              grüss dich

              adrian