I have a PHP web applications. I do NOT want to allow users to post HTML to my site.
If I simply run strip_tags
() on all data prior to saving into my database, will strip_tags
() be enough to prevent XSS?
I ask because it's unclear to me from reading the documentation of strip_tags if XSS is prevented. There seems to be some bug with browser allowing <0/script>
(yes, a zero) as valid HTML.
UPDATE
I realize that I can simply run htmlspecialchars
on all outputted data; however, my thought is that - since I don't want to allow HTML in the first place, it's simply easier (and academically better) to clean my data once and for all, before saving in my database, then have to worry every time I output the data if the data is safe or not.