I would like to add Regex validation for that input given by user in OpenCart 2.0.0.0 module. I'm trying to validate it inside validate()
in newmodule.php.
But I cant get a perfect output from preg_match()
.
After that I gone through on my regex pattern.
And there I found <
is doing some serious problem.
I got value entered by user by following function.
$this->request->post['variable'];
I printed that value. It looks exactly as user given. But <
not matched in preg_match()
...
Is there opencart doing any type of encoding like that works?
Following is my code
$var = $this->request->post['code_script'];
if(preg_match( "/<script>/s", $var ))
{
$this->error['code'] = $this->language->get('error_invalid');
}