Email Obfuscator

[code lang="Javascript"]




function cloakmail($content) {

preg_match_all("^[-a-z-A-Z-0-9\._]+@[-a-z-A-Z-0-9\._]+\.[a-z]{2,4}^", $content, $emails);

for($i = 0; $i < count($emails[0]); $i++) {
$username = explode("@", $emails[0][$i]);
$domain = explode(".", str_rot13($username[1]));

if(count($domain) > 2) {
$replace = '' . asc2html($emails[0][$i]) . '';
} else {
$replace = '' . asc2html($emails[0][$i]) . '';
}

$content = str_replace($emails[0][$i], $replace, $content);
}

return $content;
}

function asc2html($email) {
$html = "";
$len = strlen($email);
for($i = 0; $i < $len; $i++) {
$html .= "&#" . ord($email[$i]);
}
return $html;
}

$content = "Sidewinder@anything.extreme-hq.com
\n
Sidewinder@extreme-hq.com";

echo cloakmail($content);
?>

[/code]

Related posts:

  1. Binary to Decimal Conversion Converts a binary number to its decimal equivalent. However unlike the bindec function, this will preserve the binary/radix point. Code...

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.