Jump to content

Captcha image is not working


Jolsvi

Recommended Posts

Hi,

I have tried to browse some forum about blank captcha image problem, but I haven't got solution yet.

Please help, maybe someone have same issue and could share how to solve it.

 

So I have product review module, and it has captcha feature. But captcha code is not appearing. (attached 1)

When I check the inspect element, it shows (attached 2 & 3):

Notice: A non well formed numeric value encountered in /home/waterfj0/public_html/modules/homecomments/library/Captcha.php on line 76
var captcha_src = "https://waterfilterforfridge.com.au/index.php?fc=module&module=homecomments&controller=captcha&homecomments_captcha&t=0.48374300+1623974623";

 

I follow some forum and try to edit the line 76:

// Use milliseconds instead of seconds
srand(microtime() * 100);      <--- line 76 - change to: srand(microtime(true) * 100);
// Generate CAPTCHA code if not set by user
if (empty($captcha_config['code'])) {
    $captcha_config['code'] = '';
    $length = rand($captcha_config['min_length'],$captcha_config['max_length']);
    $captcha_code_length = Tools::strlen($captcha_config['code']);
    while ($captcha_code_length < $length) {
         $captcha_config['code'] .= Tools::substr(
              $captcha_config['characters'],
              rand() % (Tools::strlen($captcha_config['characters'])),
              1
         );
         $captcha_code_length = Tools::strlen($captcha_config['code']);
    }
}

 

After I edit the line 76, the captcha is showing without image at all (attached 3)

 

Currently the website is running under:

Prestashop 1.6.1.4.

PHP version 7.1

 

Thank you in advance

1.png

2.png

3.png

4.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...