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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to