How to secure Ajax link requests?

前端 未结 8 1030
刺人心
刺人心 2020-12-08 04:04

Imagine the next scenario: a user wants to register to a webpage and fills a form. While he is filling the form, jQuery keeps checking through a regular expression if fields

8条回答
  •  余生分开走
    2020-12-08 04:44

    First of all: I'd URL-encode the mail-address. 'example.com/check.php?email=' . urlencode(abcdefg@gmail.com)

    Ad your question: when check.php is called, you can

    • check, if the user's session and his IP have sent a request during the last seconds
    • if not, write the user's session, the user's IP plus the current timestamp to a helper-table plus to a cookie and hit your DB
    • if yes, block the request

    But I'm afraid this won't help you from fraud because everyone can check your JavaScript and if someone want's to exploit this, he will find ways.

提交回复
热议问题