Hide MailTo:

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Hide MailTo:

    Use this function to hide an e-mail address from spam-bots on your website. Use this function to convert the e-mail address into Unicode values and add the html tag and optional extra e-mail info like subject and body text.

    PHP Code:
    <?php 
    function hide_mailto($mail$label$subject ""$body "") {
    $chars preg_split("//"$mail, -1PREG_SPLIT_NO_EMPTY);
    $new_mail "<a href="mailto:";
    foreach (
    $chars as $val) {
    $new_mail .= "&#".ord($val).";";
    }
    $new_mail .= ($subject != "" && $body != "") ? "?subject=".$subject."&body=".$body "";
    $new_mail .= "">".$label."</a>";
    return 
    $new_mail;
    }
    ?>
    Last edited by metulj; 17.06.09, 15:15. Reason: adding [ php ] ... [ / php ] tag
    http://ngeo.ro
Working...
X