This is just a small update to my previous articleStop website enquiry form SPAM.
While my original hidden URL technique worked very well for a while – the spammers have managed to get around it. Whether they can now ‘read’ the CSS to see that it is hidden and therefore ignore it, I don’t know.
Regardless, we’re getting SPAM through that enquiry form again.
So round 2:
I decide to add a clause to the PHP that disallows links in the textarea – my thinking is that if they can’t post links, then it’s not worth them SPAMming you.
Although it took me a while to work out the code, it’s actually really simple …
www (and thanks to kkeith29 of the Daniweb forums) and http: are the strings I’ve decided to search for as it’s unlikely to come up in a normal question.
In english, the code says:
if the letters www or http: appear together in the message box, don’t email anyone and show them this message “Please don’t post links in the questions box – it looks like SPAM and your message hasn’t been sent”.
elseif (preg_match("/(http:\/\/|www)/", $msg)) {
echo "Please don't post links in the questions box - it looks like SPAM and your message hasn't been sent";
Insert this preg_match comment after …
if (!empty($url)) {
mail( “$email” , “[You're tagged as SPAM]“, … See Stop website enquiry form SPAM for the full code.
Again, I hope this one helps you out and keeps your inbox a bit cleaner.






