Home Articles Preparing Your Site Article

Protect your users’ privacy. Fight spam.

This is an easy way to fight spam.

Page Visited Visited: 4045
Not rated

by Mircea Ionescu
October 17, 2005

Mircea Ionescu
Mircea Ionescu writes for several websites like CoreDownload http://www.coredownload.com and  Adolix http://www.adolix.com You are welcome to visit them to read more articles.
Mircea Ionescu has written 2 articles for PromotionWorld.
View all articles by Mircea Ionescu...

On all the websites where users interact with each other, the email addresses have to be displayed. But this causes big troubles, due to the Spy Bots, who parse the websites and try to find email addresses. When they find an email address, this is added to a database, which will be soon sold to many companies that need potential customers. Then, in a few days, you will start receiving a lot of "super-offers", most of them being just damn scams, filling your inbox and making you waste a lot of time distinguishing useful emails from the spam-emails.

This is the reason why many people become members of sites using a "spam account", and I mean an email account that is used just for subscribing, and not a real and official email account. But what if you need to register on a site and you are forced to use an official email, something like [email protected] ? Should you register, though you know that soon your inbox will be full of useless Spam messages? Here comes the decision of webmasters, who may or may not try to protect their users' emails.

Many of the webmasters don't care about the consequences of showing their users' email addresses. But this can determine people not to register, as absolutely nobody wants to receive tones of Spam. On the other side, if the webmasters make efforts to protect their users' email addresses, the latter ones will surely be happy. And we all know that a happy user is a returning user!

That's why I recommend that all webmasters and site owners fight Spam and protect their users' privacy. There are 2 aspects that need to be considered: the text displayed and the link itself.

The HTML code of an email would look like:
    [email protected]
To better understand the explanations, I will notate:
-    mailto:[email protected] as String1
-    [email protected] as String2.
Spy Bots try to find email addresses in both String1 and String2, so it would be best to encode them both.

The best way to hide String1 is to use JavaScript. For String2, a simple replacement between "@" and "." (dot) with other characters would be enough.
username [AT] domain [DOT] com

Because normally the user's email is taken from a table in a database, I will now show you how to quickly implement this anti-Spam solution. I will use PHP, one of the most used scripting languages nowadays. We assume that $support is the variable that contains the email address.

// we will now encode String2, replacing "@" and "."
$sup_text=str_replace("@"," [AT] ",$support);
$sup_text =str_replace("."," [DOT] ",$sup_text);   

// we will now get the username from String1
// we will now get the domain name from String1
$sup_ext=""; $i=strlen($support);
while($support[$i]!=".") { $sup_ext = $support[$i].$sup_ext; $i--; }

// we will now get the domain suffix from String1
$sup_domain=""; $i--;
while($support[$i]!="@") { $sup_domain = $support[$i].$sup_domain; $i--; }

// we will now encode String1

echo "Support: $sup_hidden";

Using this method, the users' emails are displayed, but it is much harder for the Spam Bots to find them. Of course, the people behind the Spam Bots can adapt the Spy Bots Engines, but parsing the pages would be much more difficult. If you also combine the solution I described with some random text replacements (in String2), you will have an anti-Spam shield that will make the email-hunters go away from your website.

Webmasters, web freelancers, forum administrators, do not hesitate! Use this method and gain your users' trust and respect. Protect their privacy and make them feel sure that their registering to your site won't make them receive hundreds of useless Spam emails.

You can see this method successfully implemented on http://www.coredownload.com/ , a brand new software archive, with more than 23.000 titles and 8000 developers.


Submit Your Articles or Press ReleaseAdd comment (Comments: 0)  
promotion awards


Other Resources