Forum Moderators: coopster

Message Too Old, No Replies

Disallowing html without striptags()

         

brendan3eb

5:13 pm on Apr 24, 2005 (gmt 0)

10+ Year Member



I want to disallow html, javascript, etc. from my comments, but if a user types in any tags i want the tags to show up as just text when someone is viewing comments, any tips on how to do this?

ergophobe

6:02 pm on Apr 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



$plain_text = str_replace("<", "&lt;", $html);

or,
$plain_text = htmlspecialchars($html, ENT_QUOTE);

or, the "going nuclear" approach:

$plain_text = htmlentities($html, ENT_QUOTE);