تو این تکنیک، یه فیلد اضافی به فرم اضافه میکنی، اما طوری مخفیش میکنی که فقط رباتها به دامش بیفتن. کاربران واقعی این فیلد رو نمیبینن و نمیتونن پرش کنن، اما رباتها نمیفهمن قضیه چیه و اون فیلد رو هم با اطلاعات الکی پر میکنن.
وقتی فرم ارسال میشه، میری سراغ همین فیلد مخفی و نگاه میکنی؛ اگه پر بود، یعنی یه ربات سعی کرده فرم رو پر کنه، و فرم رو به عنوان اسپم رد میکنی. اینجوری، بدون اینکه کاربر متوجه بشه، فرمهات رو امنتر میکنی و رباتها رو دور میزنی.
برای راحتتر کردن کار هم میتونی از پکیج spatie/laravel-honeypot استفاده کنی که خودش همه این مراحل رو خودکار انجام میده و نیاز نیست خودت فیلد رو دستی بذاری یا چک کنی.
یه قابلیت دیگه هم که داره تایمچکه؛ به این صورت که زمان پر شدن فرم رو میسنجه. اگه یه ربات بخواد فرم رو پر کنه، خیلی سریع انجامش میده، و پکیج از همین زمان کم میفهمه که فرم رو یه ربات پر کرده نه یه آدم واقعی.
ترجمه:
Suppose you have a contact form on your site. Now, in order for spam bots not to fill this form with information, you can set a small trap; We call this trap Honeypot.
In this technique, you add an extra field to the form, but you hide it in such a way that only robots fall into the trap. Real users don’t see this field and can’t skip it, but bots don’t understand what’s going on and fill that field with fake information.
When the form is sent, you go to this hidden field and look; If it was full, it means a bot tried to fill the form, and you reject the form as spam. In this way, without the user noticing, you make your forms more secure and avoid bots.
To make the work easier, you can use the spatie/laravel-honeypot package, which does all these steps automatically, and you don’t need to add or check the fields manually.
Another feature that it has is a timer; in such a way that it measures the time of filling the form. If a robot wants to fill the form, it will do it very quickly, and the package will not understand that the form was filled by a robot and not a real person.
In this technique, you add an extra field to the form, but you hide it in such a way that only robots fall into the trap. Real users don’t see this field and can’t skip it, but bots don’t understand what’s going on and fill that field with fake information.
When the form is sent, you go to this hidden field and look; If it was full, it means a bot tried to fill the form, and you reject the form as spam. In this way, without the user noticing, you make your forms more secure and avoid bots.
To make the work easier, you can use the spatie/laravel-honeypot package, which does all these steps automatically, and you don’t need to add or check the fields manually.
Another feature that it has is a timer; in such a way that it measures the time of filling the form. If a robot wants to fill the form, it will do it very quickly, and the package will not understand that the form was filled by a robot and not a real person.