When to sanitize PHP & MySQL code before being stored in the database or when its being displayed?

前端 未结 5 1560
一向
一向 2021-01-06 10:29

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

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-06 10:48

    You should always encode data when you display it. This way your application can do no wrong. This will protect you from bad data no matter how it came to be.

提交回复
热议问题