What I want to do is limit text input to my form to basic Plain Text. This IS working code, but I'm wondering whether my function is redundant or not useful for my purposes.
I want to eliminate any tags, hex digits, etc. and insure the best I can that I simply get printable, expected results as it's rather difficult to imagine the various ways it may fail during an attack or cross-site, whatever. I fully understand there is no such thing as 100% security for forms, but I'd like to at least have some decent security in place. In particular, it doesn't seem to inhibit hex numbers.
The function is:
function check_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = strip_tags($data);
$data = htmlspecialchars($data);
$data = htmlentities( $data); // In the case of a foreign language NOT English!
return $data;
}
Any comments, advice or critiques appreciated; I've no problem with being shown that I'm wrong . Am I? lol
TIA,
Rivet`