Skip to main content
Topic: Cannot Get Vertification Captcha Working (Read 673 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Cannot Get Vertification Captcha Working

Good Morning!

I have installed Elkhart locally on Xampp (windows) to test prior to installing with my webhost. However, I am having trouble getting the Registration Verification Captcha to work (like it is on the Elkhart Community site).

Config -> Anti-Spam -> Require verification on registration page is enabled.

I also had the "Stop Spammer" Plugin installed, but uninstalled that in case it was having an impact. PHP GD library is installed.

There is obviously something I am missing here.....

Any help is appreciated.
Many thanks

P.S. Not going to be using Google's reCaptcha!

Re: Cannot Get Vertification Captcha Working

Reply #1
Further to my query, I have now installed ElkArte to a local Debian Linux virtual server to establish whether there was an issue not displaying the captcha under Xampp/Windows.

However, still no luck.

Not wanting to use Google's reCaptcha I am trying to install a similar CAPTCHA solution that ElkArte use on their registration screen (see attachment). I am now thinking that this is not inherent within ElkArts standard installation, but I cannot find a package that will provide this either.

I would appreciate any pointers.

Many thanks

Re: Cannot Get Vertification Captcha Working

Reply #2
Ok, so I have located the issue.

I downloaded and installed v1.1.5 and now have access to the CAPTCHA configuration in Configuration -> Security and Moderation -> Anti-Spam. The section "Configure Verification Methods" is completely missing in v1.1.6

Is this intentional, or a bug?

Cheers  ;)

Re: Cannot Get Vertification Captcha Working (Nearly!)

Reply #3
Following on...

Through my investigations this morning I have found that the loading of the captcha as a verification control, is missing in 1.1.6.

Adding the missing line, enables the captcha, as below:

File: sources/subs/VerificationControls.class.php - Lines 22 - 27

'known_verifications' array missing 'captcha'

Code: [Select]
function loadVerificationControls()
{
$known_verifications = array(
  'questions',
  'emptyfield'
);

change to add captcha:
   
Code: [Select]
$known_verifications = array(
  'captcha',
  'questions',
  'emptyfield'
);

Captcha is now available and works with the following issues:
  • Captcha visually too small to easily read, both in the Admin section and on the Registration page. (see attached images).
  • 'Request another image' option on registration page seems to display the same Captcha...differently.

I have noticed also that the message in the admin panel is missing from themes/default/languages/english/ManageSettings.english.php

If it was intentional that graphic captcha be removed, then I would have suspected all of the code and javascript related to this to also be removed. This makes me think that maybe it was either temporary, or an error?

I cannot find any release notes for 1.1.6, so I can't check whether this is the case.

Also, I have checked sources/subs/Graphics.subs.php, with regard to the size of the captcha, to see if there are any differences between v1.1.5 and 1.1.6, but I cannot see any significant changes relating to font/images size.

I have both versions installed on the same server with the same PHP version & GD library version.

I am just trying to understand this and get captcha working in 1.1.6, with my extremely limited knowledge. The other concern that I would have is if the enabling of the captcha will break anything else, if of course it has been deliberately disabled.

Many thanks

(PHP 7.4.5, GD 2.2.4, Debian: 9.12)

Re: Cannot Get Vertification Captcha Working

Reply #4
Thanks for your report.
I don't have a clean 1.1.6 install to test it right now, but I will do it tonight, if I remember correctly installing the Google Capthca add-on will remove the default captcha. Are you sure you didn't install first the Google add-on?
sorry for my bad english

Re: Cannot Get Vertification Captcha Working

Reply #5
Thanks for your reply.

Yes I am sure! There is no way I want to use Google stuff.

With further work I seemed to have now fixed the sizing issue.

In 1.1.6 there is a new check in sources/subs/Graphics.subs.php on lines 1034-1035:

Code: [Select]
if (!checkGD())
   return false;

This code was not present in 1.1.5 and commenting this out (or removing it) fixes the sizing issue nicely.

As far as the refresh goes, this didn't work in 1.1.5. Instead of the captcha contents being changed (letters), these stay the same regardless and it is only the styling that changes.

For now, this is sufficient for me to work with. However, it would be nice to know whether this will break anything somewhere else - I guess time will tell. I will be going live this week! :-)

I hope this helps.

Peace.


Re: Cannot Get Vertification Captcha Working

Reply #7
Sounds like a bug somewhere...
Okay, this evening no hair cut, but elk coding I guess.
Bugs creator.
Features destroyer.
Template killer.

Re: Cannot Get Vertification Captcha Working

Reply #8
No! Haircut first!  ;D

Re: Cannot Get Vertification Captcha Working

Reply #9
Well, no joy with the hairs, I couldn't confirm today for tomorrow, so I hope the spot of tomorrow will still be available tomorrow morning for tomorrow afternoon. xD

For now tried to fix the other issue, this goes to tomorrow morning.
Bugs creator.
Features destroyer.
Template killer.

Re: Cannot Get Vertification Captcha Working

Reply #10
@smilieman sorry for the long silence.
Could you try running this little script and tell me what it gives you?
Code: [Select]
<?php
echo '<pre>';
var_dump(get_extension_funcs('gd'));
echo '</pre>';
Bugs creator.
Features destroyer.
Template killer.

Re: Cannot Get Vertification Captcha Working

Reply #11
Hi Emanuele,

No worries. Ran the code, got this:

Code: [Select]
array(106) {
  [0]=>
  string(7) "gd_info"
  [1]=>
  string(8) "imagearc"
  [2]=>
  string(12) "imageellipse"
  [3]=>
  string(9) "imagechar"
  [4]=>
  string(11) "imagecharup"
  [5]=>
  string(12) "imagecolorat"
  [6]=>
  string(18) "imagecolorallocate"
  [7]=>
  string(16) "imagepalettecopy"
  [8]=>
  string(21) "imagecreatefromstring"
  [9]=>
  string(17) "imagecolorclosest"
  [10]=>
  string(20) "imagecolorclosesthwb"
  [11]=>
  string(20) "imagecolordeallocate"
  [12]=>
  string(17) "imagecolorresolve"
  [13]=>
  string(15) "imagecolorexact"
  [14]=>
  string(13) "imagecolorset"
  [15]=>
  string(21) "imagecolortransparent"
  [16]=>
  string(16) "imagecolorstotal"
  [17]=>
  string(19) "imagecolorsforindex"
  [18]=>
  string(9) "imagecopy"
  [19]=>
  string(14) "imagecopymerge"
  [20]=>
  string(18) "imagecopymergegray"
  [21]=>
  string(16) "imagecopyresized"
  [22]=>
  string(11) "imagecreate"
  [23]=>
  string(20) "imagecreatetruecolor"
  [24]=>
  string(16) "imageistruecolor"
  [25]=>
  string(23) "imagetruecolortopalette"
  [26]=>
  string(23) "imagepalettetotruecolor"
  [27]=>
  string(17) "imagesetthickness"
  [28]=>
  string(14) "imagefilledarc"
  [29]=>
  string(18) "imagefilledellipse"
  [30]=>
  string(18) "imagealphablending"
  [31]=>
  string(14) "imagesavealpha"
  [32]=>
  string(23) "imagecolorallocatealpha"
  [33]=>
  string(22) "imagecolorresolvealpha"
  [34]=>
  string(22) "imagecolorclosestalpha"
  [35]=>
  string(20) "imagecolorexactalpha"
  [36]=>
  string(18) "imagecopyresampled"
  [37]=>
  string(11) "imagerotate"
  [38]=>
  string(9) "imageflip"
  [39]=>
  string(14) "imageantialias"
  [40]=>
  string(9) "imagecrop"
  [41]=>
  string(13) "imagecropauto"
  [42]=>
  string(10) "imagescale"
  [43]=>
  string(11) "imageaffine"
  [44]=>
  string(23) "imageaffinematrixconcat"
  [45]=>
  string(20) "imageaffinematrixget"
  [46]=>
  string(21) "imagesetinterpolation"
  [47]=>
  string(12) "imagesettile"
  [48]=>
  string(13) "imagesetbrush"
  [49]=>
  string(13) "imagesetstyle"
  [50]=>
  string(18) "imagecreatefrompng"
  [51]=>
  string(19) "imagecreatefromwebp"
  [52]=>
  string(18) "imagecreatefromgif"
  [53]=>
  string(19) "imagecreatefromjpeg"
  [54]=>
  string(19) "imagecreatefromwbmp"
  [55]=>
  string(18) "imagecreatefromxbm"
  [56]=>
  string(18) "imagecreatefromxpm"
  [57]=>
  string(17) "imagecreatefromgd"
  [58]=>
  string(18) "imagecreatefromgd2"
  [59]=>
  string(22) "imagecreatefromgd2part"
  [60]=>
  string(18) "imagecreatefrombmp"
  [61]=>
  string(18) "imagecreatefromtga"
  [62]=>
  string(8) "imagepng"
  [63]=>
  string(9) "imagewebp"
  [64]=>
  string(8) "imagegif"
  [65]=>
  string(9) "imagejpeg"
  [66]=>
  string(9) "imagewbmp"
  [67]=>
  string(7) "imagegd"
  [68]=>
  string(8) "imagegd2"
  [69]=>
  string(8) "imagebmp"
  [70]=>
  string(12) "imagedestroy"
  [71]=>
  string(17) "imagegammacorrect"
  [72]=>
  string(9) "imagefill"
  [73]=>
  string(18) "imagefilledpolygon"
  [74]=>
  string(20) "imagefilledrectangle"
  [75]=>
  string(17) "imagefilltoborder"
  [76]=>
  string(14) "imagefontwidth"
  [77]=>
  string(15) "imagefontheight"
  [78]=>
  string(14) "imageinterlace"
  [79]=>
  string(9) "imageline"
  [80]=>
  string(13) "imageloadfont"
  [81]=>
  string(12) "imagepolygon"
  [82]=>
  string(16) "imageopenpolygon"
  [83]=>
  string(14) "imagerectangle"
  [84]=>
  string(13) "imagesetpixel"
  [85]=>
  string(11) "imagestring"
  [86]=>
  string(13) "imagestringup"
  [87]=>
  string(7) "imagesx"
  [88]=>
  string(7) "imagesy"
  [89]=>
  string(12) "imagesetclip"
  [90]=>
  string(12) "imagegetclip"
  [91]=>
  string(15) "imagedashedline"
  [92]=>
  string(12) "imagettfbbox"
  [93]=>
  string(12) "imagettftext"
  [94]=>
  string(11) "imageftbbox"
  [95]=>
  string(11) "imagefttext"
  [96]=>
  string(10) "imagetypes"
  [97]=>
  string(9) "jpeg2wbmp"
  [98]=>
  string(8) "png2wbmp"
  [99]=>
  string(10) "image2wbmp"
  [100]=>
  string(16) "imagelayereffect"
  [101]=>
  string(8) "imagexbm"
  [102]=>
  string(15) "imagecolormatch"
  [103]=>
  string(11) "imagefilter"
  [104]=>
  string(16) "imageconvolution"
  [105]=>
  string(15) "imageresolution"
}

Re: Cannot Get Vertification Captcha Working

Reply #12
hmm...
That's odd, because checkGD reads:
Code: [Select]
function checkGD()
{
global $gd2;

// Check to see if GD is installed and what version.
if (($extensionFunctions = get_extension_funcs('gd')) === false)
return false;

// Also determine if GD2 is installed and store it in a global.
$gd2 = in_array('imagecreatetruecolor', $extensionFunctions) && function_exists('imagecreatetruecolor');

return true;
}

so, since get_extension_funcs returns something, it should evaluate to false, meaning it returns true and removing the bits you have removed should not make any difference.

Try something slightly different, run this:
Code: [Select]
<?php
function checkGD()
{
global $gd2;

// Check to see if GD is installed and what version.
if (($extensionFunctions = get_extension_funcs('gd')) === false)
return false;

// Also determine if GD2 is installed and store it in a global.
$gd2 = in_array('imagecreatetruecolor', $extensionFunctions) && function_exists('imagecreatetruecolor');

return true;
}

global $gd2;
if (!checkGD())
echo "not gd\n";
else
echo "yes gd\n";

and see what the result is.
Bugs creator.
Features destroyer.
Template killer.

Re: Cannot Get Vertification Captcha Working

Reply #13
Ok, so nothing is returned in a browser.... but from the command line we get

yes gd

 :)

Re: Cannot Get Vertification Captcha Working

Reply #14
Then I have the feeling you are using two different versions of php, one for the CLI and one for apache...
Aaaand this is something I have no idea how to solve, server config is out of my league.
Bugs creator.
Features destroyer.
Template killer.