开发者

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.


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?


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! 


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜