Jump to content

Edit History

ksaan

ksaan

On 4/30/2019 at 11:37 AM, Assramm (cz) said:

 


<?php

class AuthController extends AuthControllerCore
{
    public function postProcess()
    {
        if(Tools::isSubmit('submitAccount')) {
         
	         $costumer = Tools::getValue('costumer');
	         $from = Tools::getValue('from');
	         
	         $firstnameAddress = ['.ru', 'www', '.com', '.'];
	         $lastnameAddress = ['.ru', 'www', '.com', '.'];

	         foreach ($firstnameAddress as $string) {
	            if(strstr($from, $string)) {
	                $this->errors[] = Tools::displayError('This name is not allowed');
	            }
	         }
	         foreach ($lastnameAddress as $string) {
	            if(strstr($from, $string)) {
	                $this->errors[] = Tools::displayError('This surname is not allowed');
	            }
	         }
	    }
        parent::postProcess();
    }    
}

You need to open one { after "if(strstr($from, $string))"

You need to close the foreach.

Fixed it for you ;) but consider hiring a professional as you're playing with fire here !

 

ksaan

ksaan

On 4/30/2019 at 11:37 AM, Assramm (cz) said:

You need to open one { after "if(strstr($from, $string))"

You need to close the foreach

So:



<?php

class AuthController extends AuthControllerCore
{
    public function postProcess()
    {
        if(Tools::isSubmit('submitAccount')) {
         
	         $costumer = Tools::getValue('costumer');
	         $from = Tools::getValue('from');
	         
	         $firstnameAddress = ['.ru', 'www', '.com', '.'];
	         $lastnameAddress = ['.ru', 'www', '.com', '.'];

	         foreach ($firstnameAddress as $string) {
	            if(strstr($from, $string)) {
	                $this->errors[] = Tools::displayError('This name is not allowed');
	            }
	         }
	         foreach ($lastnameAddress as $string) {
	            if(strstr($from, $string)) {
	                $this->errors[] = Tools::displayError('This surname is not allowed');
	            }
	         }
	    }
        parent::postProcess();
    }    
}

 

 

×
×
  • Create New...