manix Posted July 18, 2011 Share Posted July 18, 2011 Okay, that's a little confusing - say there's a user input commenting on some stuff and I need it to be displayed exactly the way the user input it, but I also need to be able to run some tags I'm adding/modifying later on to the same string Let me give you a simple example: let's say a user's comment contains "some text and <some tags> AND some of my encoding tags like *b*this*/b*" Okay so this string is supposed to output "some text and <some tags> AND some of my encoding tags like this" You get my point? if I decode the *b*'s into <strong></strong> then using htmlspecialchars() will display my tag too instead of running it - what I am aiming to do ... and using strip_tags() allowing <strong> will allow the user to input it too I hope someone can help me out with this one cuz I've been struggling with it for 2 days >.< Thank you in advance! Link to comment https://forums.phpfreaks.com/topic/242282-specialchars-user-input-but-allow-mine/ Share on other sites More sharing options...
wildteen88 Posted July 18, 2011 Share Posted July 18, 2011 Only parse the *b* and */b* tags when displaying the comments. Only use htmlspecialchars when you are inserting the comments into table. Link to comment https://forums.phpfreaks.com/topic/242282-specialchars-user-input-but-allow-mine/#findComment-1244307 Share on other sites More sharing options...
manix Posted July 18, 2011 Author Share Posted July 18, 2011 omg are you kidding me ? it was that easy ?? O.O no comment....................... Thank you ! Link to comment https://forums.phpfreaks.com/topic/242282-specialchars-user-input-but-allow-mine/#findComment-1244310 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.