Thursday, 6 December 2018

filter - What are the best PHP input sanitizing functions?

I am trying to come up with a function that I can pass all my strings through to sanitize. So that the string that comes out of it will be safe for database insertion. But there are so many filtering functions out there I am not sure which ones I should use/need.



Please help me fill in the blanks:



function filterThis($string) {
$string = mysql_real_escape_string($string);
$string = htmlentities($string);
etc...

return $string;
}

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...