This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Wrong Path To Captcha
#1

Greets,

I was asked to install this for a client. On tests we could not get the captcha code to work. I went into includes/template/form and changed this:

Code:
echo '
<img id="siimage" style="float: left;" src="' . $path_to_comments_folder . 'captcha/securimage_show.php?sid='.md5(uniqid(time())).'" alt="Captcha" title="' . CMTX_TITLE_CAPTCHA_IMAGE . '" />

<a href="' . $path_to_comments_folder . 'captcha/securimage_play.php" title="' . CMTX_TITLE_CAPTCHA_AUDIO . '"><img src="' . $settings->url_to_comments_folder . 'captcha/images/audio_icon.gif" alt="Audio" style="vertical-align: top;" onclick="this.blur()" /></a><br />

<a href="#" title="' . CMTX_TITLE_CAPTCHA_REFRESH . '" onclick="document.getElementById(\'siimage\').src = \'' . $path_to_comments_folder . 'captcha/securimage_show.php?sid=\' + Math.random(); return false"><img src="' . $settings->url_to_comments_folder . 'captcha/images/refresh.gif" alt="Refresh" style="vertical-align: bottom;" onclick="this.blur()" /></a>';

To this:

Code:
echo ' <img id="siimage" style="float: left;" src="' . $settings->url_to_comments_folder . 'captcha/securimage_show.php?sid='.md5(uniqid(time())).'" alt="Captcha" title="' . CMTX_TITLE_CAPTCHA_IMAGE . '" />

<a href="' . $settings->url_to_comments_folder . 'captcha/securimage_play.php" title="' . CMTX_TITLE_CAPTCHA_AUDIO . '"><img src="' . $settings->url_to_comments_folder . 'captcha/images/audio_icon.gif" alt="Audio" style="vertical-align: top;" onclick="this.blur()" /></a><br />

<a href="#" title="' . CMTX_TITLE_CAPTCHA_REFRESH . '" onclick="document.getElementById(\'siimage\').src = \'' . $settings->url_to_comments_folder . 'captcha/securimage_show.php?sid=\' + Math.random(); return false"><img src="' . $settings->url_to_comments_folder . 'captcha/images/refresh.gif" alt="Refresh" style="vertical-align: bottom;" onclick="this.blur()" /></a>';

As I believe the paths were wrong. Instead of paths to the URL it was showing paths from root. Now the captcha image shows. However there is another problem which I have not investigated yet and that it the captcha never accepts the entry, it always says it is incorrect.

Please confirm the above. Thanks.
Reply
#2

Hi,

I coded it to use a server path because it's sourcing a server file (PHP), but if it works better with a URL then I will fix this in the next version.

The 'always incorrect' issue will most likely be due to either cookies not being enabled in the browser or a problem with the PHP session. Did you add the following code to the very top of your page, and does the page make use of any other sessions that might be conflicting?

PHP Code:
<?php
session_start
();
ob_start();
?>

Have you completed the interview?
Reply
#3

Thanks for your answer. Yes, the URL setting is better because some server configurations will not work for this, it will also help those who had this difficulty in seeing the captcha.

Yes, we were using the example page, but as it turns out we do have a security cookie blocker that we forgot to turn off so the captcha works now, thanks for your help.
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by nsuomine
02-Mar-2024, 05:00 PM
Last Post by Rameshrao55
30-Sep-2015, 08:49 PM
Last Post by Steven
03-May-2012, 12:22 PM
Last Post by corculator
25-Feb-2012, 11:17 AM
Last Post by CarlyJ
13-Dec-2011, 07:35 AM
Last Post by Steven
07-Jun-2011, 10:37 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)