Jump to content

Edit History

max565

max565

Steve Joms

Can you update this for 2023 or prestashop version 1.7.8.10

Your guide doesn't work for the newest version of prestashop

I keep getting spam everyday and there is no way to stop this unless we add your guide

 

 

public_html/shop/themes/classic/modules/contactform/views/templates/widget/contactform.tpl

after

[code]

              {l s='optional' d='Shop.Forms.Help'}
            </span>
          </div>
        {/if}

[/code]

[code]

    <p class="form-group">
    <br>
    <label for="mathCaptcha">{l s='Number captcha (Robot checking):'}</label><br>
        
        <input type"text" id="mathNumber1" name="mathNumber1" value="{$mathNumber1}" hidden="true" />
        <input type"text" id="mathNumber2" name="mathNumber2" value="{$mathNumber2}" hidden="true" />
        
        {$mathNumber1} + {$mathNumber2} = <input type="text" id="mathAnswer" name="mathAnswer" autocomplete="off"/>
        <br>
        <br>
    
    </p>  

[/code]

 

 

public_html/shop/controllers/front/ContactController.php

after

[code]

    public function initContent()
    {
    parent::initContent();

[/code]

[code]

  $this->context->smarty->assign('mathNumber1',rand(1,10));
    $this->context->smarty->assign('mathNumber2',rand(1,10));
    

[/code]

 

public_html/shop/modules/contactform/contactform.php

after

[code]

        $this->contact['contacts'] = $this->getTemplateVarContact();
        $this->contact['message'] = Tools::getValue('message');

[/code]

 

[code]

        $mathAnswer = Tools::getValue('mathAnswer');
        $mathNumber1 = Tools::getValue('mathNumber1');
        $mathNumber2 = Tools::getValue('mathNumber2');
        $mathSum = $mathNumber1 + $mathNumber2; 

[/code]

 

 

 

after

[code]

            $this->context->controller->errors[] = $this->trans(
                'Bad file extension',
                [],
                'Modules.Contactform.Shop'
            );

            return;
        }

[/code]

 

 

[code]

             elseif(!$mathAnswer){
                $this->errors[] = Tools::displayError('The answer must not be blank');
            }
            
            
            elseif($mathSum!=$mathAnswer){
                $this->errors[] = Tools::displayError('The answer is wrong');
            }
           

[/code]

 

 

i tried that and i see the math question but it doesn't verify the math. The message still goes through

max565

max565

Steve Joms

Can you update this for 2023 or prestashop version 1.7.8.10

Your guide doesn't work for the newest version of prestashop

I keep getting spam everyday and there is no way to stop this unless we add your guide

max565

max565

Steve Joms

Can you update this for 2023 or prestashop version 1.7.8.10

Your guide doesnt work for the newest version of prestashop

I keep getting spam everyday and there is no way to stop this

max565

max565

Can you update this for 2023 or prestashop version 1.7.8.10

Your guide doesnt work for the newest version of prestashop

I keep getting spam everyday and there is no way to stop this

×
×
  • Create New...