Welcome Guest, Not a member yet? Register   Sign In
How to ringfence or contain user-submitted HTML
#1

[eluser]Daniel H[/eluser]
Hi all

I allow users to use TinyMCE to submit posts to a forum. While this generally works well I am concerned that if users copy and paste HTML from other sites etc. there is potential for their post to break the structure of the forum; for example if somehow they include a unclosed <strong>, <div>, <p> tag etc.

I still want to allow use of all the major tags, but can anyone suggest a way of ensuring that their HTML is essentially contained so that it won't affect the layout of the page the posts appear in?

Thanks.
#2

[eluser]manilodisan[/eluser]
The question is....do you want their submission to be able to modify the structure of your layout when displayed? If not, why not use a html to xhtml function or something...maybe htmlspacialchars.
#3

[eluser]kRON[/eluser]
I think you'll love PHP Markdown, a PHP port of Markdown.

You can combine it with Showdown to give users preview feedback.
#4

[eluser]Daniel H[/eluser]
I would love to use Markdown but unfortunately I'm competing with the old site based on vBulletin which uses a rich text editor.

In fact thinking about it I'll just go with TinyMCE, remove divs, and hope for the best!! If it turns out people go a bit mad then I'll rethink.




Theme © iAndrew 2016 - Forum software by © MyBB