As many people have already suggested: use the honey pot input field. But there are two more things you need to do. First randomize the name / identifier whose input field is a honey pot. Store the state of the useful fields in the session (as well as the form token used against CSRF attacks). For example, you have the following fields: name, email address, message. In your form, you will have a “token”, which is your token, “jzefkl46”, which is the name of this form, “ofdizhae” for email “45sd4s2” for the message, and “fgdfg5qsd4” for the honey bank. In a user session, you might have something like
array ("forms" => array ("your-token-value" => array ("jzefkl46" => "name",
"ofdizhae" => "email",
"45sd4s2" => "message",
"fgdfg5qsd4" => honey ")); You just need to re-link it when you receive your form data.
Secondly, since the robot has many chances to avoid the field of your honey pot (25% chance), multiply the number of pots. With 10 or 20 of them, you add difficulty to bots without having too much overhead in your html.
Arkh Oct 16 '09 at 13:37 2009-10-16 13:37
source share