So I updated my awesome portfolio over at burningafro.org. To be more specific, an e-mail form.
2 minutes after I updated my portfolio I got lots of mails. "Wow I'm famous now" I thought. Checked my mail, and found out it was just spam.
Even with an e-mail checker in my php file, the spam was from a legit e-mail adress. I will now explain shortly what happens, and how to fix it.
Bots search for mailforms all over the internet, when they find one, they can fill in all forms within the page-adress (your navigation bar at the top of your browser). This happens in a matter of seconds, but it'll annoy the hell out of you.
THE FIX
Make an extra input box in your mailform. Call it something common, and give it an id, but something that you won't use. For example "Your phone number". Now, if you have a php file which checks which fields are filled in (you probably have one, it's the most common mailform out there) and say this in php: If ['phone'] is filled in, then don't send an e-mail. Now you might think your legit visitors will fill this one in, and they won't be able to send an e-mail.
Here's the fun part; Go to your css file, and find that particular text box (#phone-number). Now make it invisible by using visibility: hidden; Find your table, and give it a minus-topmargin of around 20px. The invisible text-box will push your form down a bit, with this margin fix everything's back to normal.
Your legit users won't notice any difference, and fill in the text boxes they see. Which will send an e-mail to you.
Bots however, can not see any differences between a hidden text-field and a visible text-field. So they will automatically fill in the phone number, resulting in an error.
No spam for awesome people anymore! (I derived this from the fact that people who have this fix are reading my blog, therefore are awesome)