Re: Hide email addresses from spam bots
| From: | Richard Lynch | Date: | Wed, 01 Feb 2006 23:04:36 +0000 |
| Subject: | Re: Hide email addresses from spam bots | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-229679@lists.php.net to get a copy of this message | ||
On Wed, February 1, 2006 7:23 am, Gerry Danen wrote:
> A user of mine insists that her email address shows on a web page. I
> need to protect that address from spam bots. There are lots of
> solutions around that I have come acros. I am looking for a clean,
> reusable, non-javascript solution.
As stupid as it sounds, something as simple as:
function spaminator($email, $html = ''){
$html = strlen($html) ? $html : $email;
$email = str_replace('@', %40', $email);
$html = str_replace('@', '@', $html);
return "<a href=\"mailto:$email\">$html</a>";
}
Now, you might be saying, but surely the spam-harvesters could catch
that?!
Well, yes, they COULD.
But consider this:
Every time a spam harvester casts his net, he gets 1,000,000 emails
off the net.
How much effort will the harvester invest in building a better net?
Zero.
NOTE:
AOL 4.0 (ancient) will not correctly handle the %40 in the URL.
--
Like Music?
http://l-i-e.com/artists.htm