Definition:
function antispambot($emailaddy, $mailto=0) {}
Converts email addresses characters to HTML entities to block spam bots.
Parameters
- string $emailaddy: Email address.
- int $mailto: Optional. Range from 0 to 1. Used for encoding.
Return values
returns:Converted email address.
Source code
function antispambot($emailaddy, $mailto=0) { $emailNOSPAMaddy = ''; srand ((float) microtime() * 1000000); for ($i = 0; $i < strlen($emailaddy); $i = $i + 1) { $j = floor(rand(0, 1+$mailto)); if ($j==0) { $emailNOSPAMaddy .= '&#'.ord(substr($emailaddy,$i,1)).';'; } elseif ($j==1) { $emailNOSPAMaddy .= substr($emailaddy,$i,1); } elseif ($j==2) { $emailNOSPAMaddy .= '%'.zeroise(dechex(ord(substr($emailaddy, $i, 1))), 2); } } $emailNOSPAMaddy = str_replace('@','@',$emailNOSPAMaddy); return $emailNOSPAMaddy; }
531
No comments yet... Be the first to leave a reply!