Request and URL security
No, it is urlencode
used to convert strings to URL encoding.
Unlike a numeric identifier, there is no uniform method to sanitize the input string value. Which method you need to use depends on what you want to do with the category name.
For instance:
-
If you want to use it in a query, run at least a
mysql_real_escape_string()
on it, or (better) use a database class that supports parameterized queries (like PDO). With parameterized requests, PDO takes care of the safe disinfection of any incoming parameters. -
If you want to output it to the page, you need to run
htmlentities()
on it before outputting to prevent HTML injection.
there are other things to consider when using a category name as a filename when using it as part of a url, etc. etc.
a source to share