Advertisement
Kresha7

SpamSafeEmail Function

Dec 18th, 2011
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. /**
  2.  * spamsafeemail() - Purpose is to modifiy the email address to
  3.  *                   hide it from website spiders which scan for emails for example to use
  4.  *                   them for spam purpose.
  5.  * @param mixed $email - the email address
  6.  * @param string $at - replacement value for @
  7.  * @param string $dot - replacement value for .
  8.  * @return - the email returned example: myname[at]mail[dot]com
  9.  */
  10. function spamsafeemail($email,$at = '[at]',$dot = '[dot]')
  11. {
  12.     if(!empty($email))
  13.     {
  14.         if(strstr($email,'@') && strstr($email,'.'))
  15.         {
  16.             return str_replace('.',$dot,str_replace('@',$at,$email));
  17.         }
  18.      
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement