Posted By

khaled on 02/20/10


Tagged

email javascript spam spammer


Versions (?)

Hide Email From Spammer by php and Javascript (Under Testing)


 / Published in: PHP
 

  1. <?php
  2. function hide_from_spam($Email='[email protected]'){
  3. $Email = str_replace('@', '&#64;', $Email);
  4. $Email = str_replace('.', '&#46;', $Email);
  5. $Email = str_split($Email, 4);
  6.  
  7. // Print email using JavaScript
  8. $anti_spam = '<script type="text/javascript">';
  9. foreach($Email as $write_email){
  10. $anti_spam .= "document.write('$write_email');";
  11. }
  12. $anti_spam .= '</script>';
  13.  
  14. return $anti_spam;
  15. }
  16.  
  17. echo hide_from_spam('[email protected]');
  18.  
  19. ?>

Report this snippet  

You need to login to post a comment.