Page 1 of 1

Captcha Problem

Posted: 2011-05-17 04:42
by Timespider
Hi, I have had a captcha field working on two sites for a couple of years & now they have stopped working. I'm running php 5.2.17 & have the fixes in the includes folder. Could someone give me their captcha field code so I can compare it to mine, here it is

TOP OF PAGE CODE

Code: Select all

<?php // Captcha Image
$captcha_id_obj = new KT_CaptchaImage("captcha_id_id");
?>
CAPTCHA INPUT FIELD FORM CODE the getImageURL is empty & on the page it has the field but where the image was I now only get this code <img src=" I have tried changing the permissions to 777 in the captcha folder but no luck

Code: Select all

<tr>
<td class="KT_th">Enter code: <span class="style3">*</span></td>
<td><div align="left">
<input type="text" name="captcha_id" id="captcha_id" value="" />
<br />
Type the characters you see in the picture below.<br />
<img src="<?php echo $captcha_id_obj->getImageURL("../");?>" border="1" /></div></td>
</tr>
Has anyone had this happen before?

Thanks Chris

Re: Captcha Problem

Posted: 2011-05-18 15:53
by Fred

Code: Select all

// Captcha Image
$captcha_id_obj = new KT_CaptchaImage("captcha_id_id");

Code: Select all

  <td><input type="text" name="captcha_id" id="captcha_id" value="" />
                    <br />
        <?php p('Type_Characters');?>.<br />
        <img src="<?php echo $captcha_id_obj->getImageURL("");?>" border="1" /></td>
              </tr>
              <tr class="KT_buttons">
                <td colspan="2"><input type="submit" name="KT_Custom1" id="KT_Custom1" value="Send Email" />
                </td>

Re: Captcha Problem

Posted: 2011-05-18 23:03
by Timespider
Hi Fred, yours looks pretty much the same as mine. My host is running suPHP & I have max permissions of 755 could this be causing the problem?

Regards Chris

Re: Captcha Problem

Posted: 2011-05-19 18:21
by Fred
No it shouldnt.
I also have suphp on my servers and CHMOD set to 755 on the folders with no problems and 644 on the actual files.
Is suphp a recent upgrade?

Re: Captcha Problem

Posted: 2011-05-19 23:14
by Timespider
Hi Fred, I think it's a recent upgrade but I'm not sure, i'm just checking. I also noticed that my submit button doesn't show either, no matter where I put it in the form. I also can't create a new captcha on any sites on the server. Do you have any other ideas? Here's the link to one of the pages. http://www.fellsfarmmx.co.nz/Main%20Site/signOn.php

Thanks Chris

Re: Captcha Problem Fixed

Posted: 2011-05-22 01:15
by Timespider
Thought I'd post the fix.

The problem ended up being in the page KT_CaptchaImage.class.php found here /includes/common/lib/captcha/KT_CaptchaImage.class.php.

On line 86 replace this

Code: Select all

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

Code: Select all

$okttf = false;
if(function_exists('imagettftext')) {
     $okttf = @imagettftext($im, 14, rand(-25, 25), 10+$i*$wFont, $hFont+rand(4, 26), $text_color, $fontFileName, $string[$i]);
}
The original article was on interakt http://www.interaktonline.com/Products/ ... oblem.html it had to do with the GD library not having support for freetype enabled. Which must have been something my host changed, as I said this has been working fine for years.

Cheers Chris