Distortion Posted December 3, 2009 Report 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 Report 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 Report 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 Report 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
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now