Good Form Security - no CAPTCHA

后端 未结 9 1761
情歌与酒
情歌与酒 2020-12-08 06:44

Is there a good method of form security that does not involve CAPTCHA? CAPTCHA is so annoying, but I need security because I am getting form spam. My form is

9条回答
  •  死守一世寂寞
    2020-12-08 07:42

    I have already worked something similar.

    1. When you open a form generate one md5() string and put it in session (for example $_SESSION['captha'])
    2. Your form sould have one hidden field and when you open this form write this data from $_SESSION['captha'] into this hidden field
    3. When you receive this post request compare value in session and value which come with this hidden field. If it is same everithing is ok and vice versa. Of course, after you handle this request just delete variable $_SESSION['captha'].

    This work for me.

提交回复
热议问题