Forum Moderators: coopster
I have a bunch of user input (basically that's all this site is about) and I mainly want to protect myself from someone adding some bad code in there. I think I can do most of this with htmlentities() or htmlspecialchars(). I've noticed that some also recommend stripslashes() and str_ireplace().
I guess I mainly want to protect from '<', '>', '$', and ';'.
The other thing is that it would be nice if there was a way to write a function to check all the input, since I have a lot of fields. The data is getting passes from the form by way of POST before it is INSERTed into the DB.
Is there an easy, straight forward way to do this?
$bad_chars = array('<', '>', '$',';');
str_replace [us2.php.net]($bad_chars, "", $text_to_search);
Good luck!
eelix