This function allows it to hide the email address within a link so it is not this easy to be grabbed by spiders.

This function allows it to hide the email address within a link so it is not this easy to be grabbed by spiders.
 
<code class="prettyprint">
function mailto($address, $text)
{
    $address_encode = '';
    for ($x=0; $x < strlen($address); $x++) {
        if(preg_match('!\w!',$address[$x])) {
            $address_encode .= '%' . bin2hex($address[$x]);
        } else {
            $address_encode .= $address[$x];
        }
    }
    $text_encode = '';
    for ($x=0; $x < strlen($text); $x++) {
        $text_encode .= '&#x' . bin2hex($text[$x]).';';
    }
 
    $mailto = "mailto:";
    return '<a href="'.$mailto.$address_encode.'">'.$text_encode.'';
}
 
echo mailto('my@mail.com','Mail me');
</code>

Bookmark this!

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • del.icio.us
  • Digg
  • Fark
  • Furl
  • MisterWong
  • NewsVine
  • Reddit
  • Spurl
  • StumbleUpon
  • TailRank
  • Technorati

Submit your comment

vision22.net

Copyright © 2007