How do I prevent others from sending their own data to my php page?

后端 未结 5 1900
孤独总比滥情好
孤独总比滥情好 2020-12-20 04:01

Suppose I have a registration page in my website that contains a registration form:

5条回答
  •  天命终不由人
    2020-12-20 04:39

    You can include a token in your form that only your site would know (and store it in a session variable). Then when the form is submitted you check to see if that token exists and is valid. If it is, continue processing the form. If it isn't, throw an error.

    This is also very useful for defending against Cross-Site Request Forgery (CSRF) attacks.

提交回复
热议问题