Okay I was wondering when should I sanitize my code, when I add store it in the database or when I have it displayed on my web page or both?
I ask this question beca
There are distinct threats you are (probably) talking about here:
What's harmful to your database is not necessarily harmful to the users (and vice versa). You have to take care of both threats accordingly.
In your example:
You probably want to use the purifier prior to data insertion - just ensure it's "purified" by the time the user gets it.
You might need to use striplashes() on data retrieved from the db to display it correctly to the user if magic_quotes
are on