Posted By

jdmyers on 01/06/10


Tagged

php


Versions (?)

Mail Header Removal


 / Published in: PHP
 

  1. ################################################################
  2. #
  3. # Mail Header Removal
  4. # - SPAM Prevention, just removes the headers
  5. # - Original Source: http://www.digital-web.com/articles/bulletproof_contact_form_with_php/
  6. #
  7. ################################################################
  8. function remove_headers($string)
  9. {
  10. $headers = array(
  11. "/to\:/i",
  12. "/from\:/i",
  13. "/bcc\:/i",
  14. "/cc\:/i",
  15. "/Content\-Transfer\-Encoding\:/i",
  16. "/Content\-Type\:/i",
  17. "/Mime\-Version\:/i"
  18. );
  19. return preg_replace($headers, '', $string);
  20. }
  21.  
  22. with strip_tags()
  23.  
  24. function remove_headers($string)
  25. {
  26. $headers = array(
  27. "/to\:/i",
  28. "/from\:/i",
  29. "/bcc\:/i",
  30. "/cc\:/i",
  31. "/Content\-Transfer\-Encoding\:/i",
  32. "/Content\-Type\:/i",
  33. "/Mime\-Version\:/i"
  34. );
  35. $string = preg_replace($headers, '', $string);
  36. return strip_tags($string);
  37. }

Report this snippet  

You need to login to post a comment.