I want to know how I can identify a specific term or word in a input on php. Like if they write <script>
, it will not be allowed to submitted. So that people don't hack my website.
So I need I code to see if that term or word it was written in the input. I mean, if the input was jkgdknf <script> iofosef
I will like the program to not allow the guy to submit that input.
Thanks !
The easiest thing for that is strip_tags():
$string = strip_tags($_POST['input']);
This function tries to return a string with all NUL bytes, HTML and PHP tags stripped from a given str.