FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

how do you Exclude Certain html tags?

 


flatliner
Hi there I am currently building a forum application call "Flatline Community". I have come up agaisnt a problem with user posting and styling messages. I cant allow full html for secuity reasons but yet if I cut it all out all the styling goes down the drain. I have seached the net quite abit on this topic but there seem to be very little info on it. Any sites you can send me 2 or examples you can post are very welcome thank you.

P.s The forum application is built in PHP and MySQL


Kind Regards
Ciaran Mc Cann
jabapyth
you know BBCode, don't you? It's used by many forums (this included). It looks like
Code:
[b]Bold[/b], [i]italics[/i], etc....

If you don't want to do that, then you could run a regex (sever side, so it can't be bypassed)
Code:

re.sub(/<(?P<start>[^a|b|i|u|(?:br)|(?:li)|(?:ul)|(?:ol)]).+?>.+?</(?=<start>)>/,"")

or something like that. I strongly suggest bbcode, however, because if you allow a tags, they could insert onclick javascript.
flatliner
Yes I know BBcode but how do I support it ? like were do I get it from coz its not just going to work just by using the tags or does it?
flatliner
actaully nvm , I got it lol. thanks for your help
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.