How to hide email on a site from spammers

The first way through JavaScript:

<script type="text/javascript" language="JavaScript">
var login  = 'user';
var server = '';
var email  = login+'@'+server;
var url = 'mailto:'+email;
document.write('<a href="'+url+'">'+email+'</a>');
<noscript><img src="URL_img"></noscript>

If the user has JavaScript disabled, then the picture indicated in the noscript tags will be displayed.

The second way through PHP:

$email = '';
$url = '';
for($i=0; $i $safe_email .= '&#'.ord($email{$i}).';';
for($i=0; $i $safe_url .= '&#'.ord($url{$i}).';';
print "<a href="$safe_url">$safe_email</a>";

Leave a comment

Leave a Reply