To avoid XSS injections, you need to use strip_tags() , htmlspecialchars() , htmlentities() when displaying user input. I think it's better to use strip_tags() and \ or htmlentities() .
If this output is read from the database, then the data must first be written to the database and then questions arise:
What and in what sequence to apply to the data that will be written to the database?
2.1 About stmt requests I know and understand http://ua2.php.net/manual/ru/mysqli.quickstart.prepared-statements.php
2.2 I want to know the approximate variants of the data processing order before saving to the table.
2.2.1 First, stip_tags() and \ or htmlentities() -> (if you want to keep some html formatting in safe mode)
2.2.2 then mysqli_real_escape_string() -?
2.2.3 Replacing % and _ ( $more_escaped = addcslashes($escaped, '%_'); )
2.2.4 "tags", type [b] [code] [i] [url] to use for processing BEFORE data output.
- The network was a wonderful article about sql-injections using \ based on multibyte encodings. Who knows about this method of sql injection?
Yes, one more thing, single quotes are two types:
`and '
some of them are not screened, need to check?
If it is not screened, then it is necessary to screen separately (as with _ and % )?