Cudos
Cudos

Reputation: 5894

Prevent spammer to sneak in URL & link in mail

I have a spammer that use my PHP e-mail contact form and write this in the mail message:

[url=http://qjtouvifclfk.com/]qjtouvifclfk[/url]
[link=http://gqmrjhtujkoe.com/]gqmrjhtujkoe[/link]
http://tkihpjlwszyw.com/

I want to search for anything that ha [url= and [/url] and [link= and [/link] and http:// and .com in the message and remove it.

Upvotes: 1

Views: 480

Answers (3)

Frank Martin
Frank Martin

Reputation: 1851

I used to get the same thing about 2 years ago. Add a honey pot to your contact form. This is an extra input which is hidden with CSS then in your PHP check that it has an empty value before running your mail script. Honey pots stop spam bots from filling out your forms, I've used this on 50+ sites so far with no problems. Let me know if you want more info on how to.

Upvotes: 0

Brad
Brad

Reputation: 163438

This happens all the time. Automated bots will POST on your forms, searching for something they can use as a spam relay.

There are many methods for working around it. The most common is CAPTCHA, but your users will hate you.

See this post: Alternative to Captcha?

Upvotes: 2

genesis
genesis

Reputation: 50974

preg_replace("/\[url=(.*)\](.*?)\[\/url]\/i", "", $text);
preg_replace("/\[link=(.*)\](.*?)\[\/link]\/i", "", $text);
preg_replace("/http:\/\/\/i", "", $text);
preg_replace("/\.com/i", "", $text); //this is very agresive line! 

Upvotes: 0

Related Questions