Posted By

traeregan on 08/09/09


Tagged

email mailto address Obfuscation


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

irishsk
umang_nine
BrianCoyDesign


Mailto: Email Obfuscation (ASCII)


 / Published in: PHP
 

URL: http://www.givegoodweb.com/post/67/php-email-obfuscate

  1. function safeEmail($email)
  2. {
  3.  
  4. $obfuscatedEmail = '';
  5. $email = eregi_replace('#','', $email);
  6. $length = strlen($email);
  7.  
  8. for ($i = 0; $i < $length; $i++)
  9. {
  10. $obfuscatedEmail .= "&#" . ord($email[$i]);
  11. }
  12.  
  13. $return = '<a href="mailto:' . $obfuscatedEmail . '">'.$obfuscatedEmail.'</a>';
  14.  
  15. return $return;
  16. }

Report this snippet  

You need to login to post a comment.