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

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

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

5条回答
  •  隐瞒了意图╮
    2020-12-20 04:49

    Create a random token and send it along with the form data as a hidden html element. Bind the token along with the user session and validate it once the form is submitted/posted back. The other guy cannot send this random token as your server will not have that token in the session.

    Also use X-Frame-Options header to avoid usage of your page as an iframe in his website. Hope this helps.

提交回复
热议问题