Answer the question
In order to leave comments, you need to log in
Is it correct to screen the data before working in the database, as implemented in opencart?
opencart has an escape function to escape the value before working with the base
public function escape($value) {
$search = array("\\", "\0", "\n", "\r", "\x1a", "'", '"');
$replace = array("\\\\", "\\0", "\\n", "\\r", "\Z", "\'", '\"');
return str_replace($search, $replace, $value);
}
Answer the question
In order to leave comments, you need to log in
Wrong and dangerous. The data does not need to be explicitly escaped.
But placeholders need to be used. Screening will actually be done, but in the depth of the driver or even by means of the database client.
$this->db->escape($string);
Did you try to open the source codes and see the available methods for working with the database?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question