Distortion Posted December 3, 2009 Share Posted December 3, 2009 On my website people should be able to send short messages to eachother, but they shouldn't be able to add links or other things with html.I tried converting the input text with strip_tags(); and nl2br(); but this has the disadvantage that innocent things like <Distortion> get deleted as well.Best would be if I could convert the message when it is send to plain text, because maybe I want to use automatic messages that can contain html. Next best is to simply stop the displayed string from being executed as html.Any ideas how to do this? Link to comment Share on other sites More sharing options...
thescientist Posted December 3, 2009 Share Posted December 3, 2009 something like thishttp://psoug.org/snippet/Convert_HTML_to_plain_text_36.htm Link to comment Share on other sites More sharing options...
Ingolme Posted December 3, 2009 Share Posted December 3, 2009 You can use htmlentities() or html_special_chars() to convert HTML into non-parseable code. So that the tags will appear as if they were written as text. Link to comment Share on other sites More sharing options...
gar onn Posted December 9, 2009 Share Posted December 9, 2009 Jes htmlentities()and than replace "<Distortion>" by <Distortion>;and you have your tag back Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.