Post Reply 
Wrong Path To Captcha
11-Jul-2011, 11:59 PM
Post: #1
Wrong Path To Captcha
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.

Pro Web Design & Customization
Find all posts by this user
Quote this message in a reply
12-Jul-2011, 10:43 AM
Post: #2
RE: Wrong Path To Captcha
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?
Find all posts by this user
Quote this message in a reply
12-Jul-2011, 01:09 PM
Post: #3
RE: Wrong Path To Captcha
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.

Pro Web Design & Customization
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  something is wrong with the layout Bleemster 14 775 09-Aug-2012 09:06 PM
Last Post: 2hands
  Captcha don't work on subdirectory jaris 3 825 03-May-2012 01:22 PM
Last Post: Steven
  Image url wrong in db corculator 4 269 25-Feb-2012 12:17 PM
Last Post: corculator
  Captcha Audio button CarlyJ 2 338 13-Dec-2011 08:35 AM
Last Post: CarlyJ
  Wrong encoding of comment quote in e-mails. stariocek 2 613 24-Aug-2011 01:30 PM
Last Post: stariocek
  Captcha Not Working With Subdomain Looking 7 988 21-Jul-2011 08:18 PM
Last Post: Looking
  Path wrong for MAMP Norbs 1 266 07-Jun-2011 11:37 AM
Last Post: Steven

Forum Jump:


User(s) browsing this thread: 1 Guest(s)