Nombre: Código fuente para reducir el spam.
Descripción:
Este código fuente antispam, es para proteger tus correo electrónicos en el sitio donde hay la necesidad de publicarlos, para que no sean obtenidos de forma automática, y solamente por aquellos usuarios que estén navegando visualmente por el sitio.
URL: http://www.mygnet.net/codigos/php/correoelectronico/codigo_fuente_para_reducir_el_spam.682
Código Fuente:
<?
/*
Martin R. Mondragon Sotelo
martin@mygnet.com
*/
function fun_htmlencode($str)
{ for($i=0;$i<strlen($str);++$i)
{ $n = rand(0,1);
if($n)$cad.='&#x'.sprintf("%X",ord($str{$i})).';';
else $cad.='&#'.ord($str{$i}).';';
} return $cad;
}
function fun_antispam($str,$titulo="")
{ $titulo=trim($titulo)==""?$str:$titulo;
$em=explode("@",$str);
return "<script type="text/javascript"><!-- n".
"document.write('<a href="mailto:' + '".
fun_htmlencode($em[0])."' + '@' + '".
fun_htmlencode($em[1])."' + '">".$titulo."</a>');".
"// -->n</script>";
}
// echo fun_antispam("martin@mygnet.com")."<bre>";
// echo fun_antispam("martin@mygnet.com")."<bre>";
?>