var login = 'spammer' ;
var server = 'must.die' ;
var email = login+ '@' +server;
var url = 'mailto:' +email;
document .write( '<a href="' +url+ '">' +email+ ' ' );
$email = 'spammer@must.die'; $url = 'mailto:spammer@must.die'; $safe_email=$safe_url=''; for($i=0; $i<strlen($email); $i++){ $safe_email .= '&#'.ord($email{$i}).';'; } for($i=0; $i<strlen($url); $i++){ $safe_url .= '&#'.ord($url{$i}).';'; } print "<a href='$safe_url'>$safe_email</a>";
function encode(email, text, tpl) {
var t = tpl.replace(/{e}/g, email);
var a = t.replace(/{text}/g, text);
t = "" ;
for (i = 0; i < a.length; i++) {
if (a.charCodeAt(i) <= 127) {
t += (String.fromCharCode(Math.floor(a.charCodeAt(i) / 16) + 65))
t += (String.fromCharCode(a.charCodeAt(i) % 16 + 65));
} else {
t += a.charAt(i);
}
}
var to = t;
return t;
}
function decode(a) {
var t = "" ;
for (i = 0; i < a.length; i++) {
t += (a.charCodeAt(i) <= 127) ?
String.fromCharCode((a.charCodeAt(i) - 65 ) * 16 + (a.charCodeAt(++i) - 65))
:
a.charAt(i);
}
return t;
}
* This source code was highlighted with Source Code Highlighter .
function encode_email ($ email, $ text = null, $ tpl = null) { if (empty ($ email)) return false; if ($ tpl === null) $ tpl = "<A HREF=\"mailto:{e}\" {text} </A>"; if ($ text === null) $ text = $ email; $ t = str_replace ('{e}', $ email, $ tpl); $ a = str_replace ('{text}', $ text, $ t); $ result = ''; for ($ i = 0; $ i <strlen ($ a); $ i ++) { if (ord ($ a [$ i]) <= 127) { $ result. = chr (floor (ord ($ a [$ i]) / 16) + 65) . (string) chr (ord ($ a [$ i])% 16 + 65); } else { $ result. = (string) $ a [$ i]; } } $ code = ""; $ code. = "<script type = \" text / javascript \ ">" . "a = \" ". $ result." \ ";" . "for (i = 0; i <a.length; i ++) {document.write ((a.charCodeAt (i) <= 127)? String.fromCharCode ((a.charCodeAt (i) -65) * 16 + ( a.charCodeAt (++ i) -65)): a.charAt (i))} " . "</". "script>" . "<noscript>". str_replace (array ('@', '.'), array ('©', '·'), $ email). "</ noscript>"; return $ code; }
')
Source: https://habr.com/ru/post/43209/
All Articles