I am currently working on a website where users can write articles with small format features (e.g. bold, italics, list ...). I use the framework: CodeIgniter.
I am a newbie and I heard something about XSS. I would like to know what you think about my implementation. I read this topic: What is the best method for sanitizing user input using PHP?
1) The user writes his article, format it using BBCode. I am using SCEditor.
2) When saving it to the database, I use htmlspecialchars () to filter out any suspicious HTML tag. Should I do this when I save data or show data?
3) When I want to display an article on a website (for example, for other purposes), I convert BBCode tags to HTML tags.
Is this right to do? Am I avoiding XSS?
I am obviously open to suggestions and advice.
thank you for your responses
user2500511
source share