by Etrai » Sun Oct 13, 2002 3:24 am
This is kind of what I had in mind, however; say that FOO posts the following:
</td>I'm trying to create my own forum using php. My problem is posts. If someone were to post something including HTML tags, they would be parsed by the browser. This could prove quite disruptive.<br><br>
So I wonder if anyone can point me in the right direction for isolating <i>HTML tags</i> in a string? I.e. show me a way to annihilate and/or replace disruptive tags.<td>
Since "<br>" and "<i></i>" are harmless, they should be parsed by the browser, but "<td></td>" that are very disruptive shouldn't.
When using htmlspecialchars() all tags are made ineffective.
What I'm acctually looking for here is taking out "<whatever>" and/or "</whatever>" from the post and comparing it to a list of valid options. If "<whatever>" is valid let it be as it is, if not, htmlspecialchar()-it or replace it with "".
I.e. I'm trying to "create" a reduced version of HTML.