What are the best practices for avoiding xss attacks in a PHP site

前端 未结 20 2374
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-22 02:34

I have PHP configured so that magic quotes are on and register globals are off.

I do my best to always call htmlentities() for anything I am outputing that is derive

20条回答
  •  青春惊慌失措
    2020-11-22 03:18

    If you are concerned about XSS attacks, encoding your output strings to HTML is the solution. If you remember to encode every single output character to HTML format, there is no way to execute a successful XSS attack.

    Read more: Sanitizing user data: How and where to do it

提交回复
热议问题