<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>GEO</title>
<script type="text/javascript">
window.onload = function () {
geo();
}
function geo() {
if (!document.getElementsByTagName)
return false;
if (rot13)
var map = rot13init();
var links = document.getElementsByTagName('a');
function geo_decode(anchor) {
var href = anchor.getAttribute('href');
var address = href.replace(/.*contact\/([a-z0-9._%-]+)\+([a-z0-9._%-]+)\+([a-z.]+)/i, '$1' + '@' + '$2' + '.' + '$3');
var linktext = anchor.innerHTML;
if (href != address) {
anchor.setAttribute('href','mailto:' + (rot13 ? str_rot13(address,map) : address));
anchor.innerHTML = linktext;
}
}
for (var l = 0 ; l < links.length ; l++)
{
links[l].onclick = function()
{
geo_decode(this);
}
links[l].onmouseover = function()
{
geo_decode(this);
}
}
}
var rot13 = 1;
function rot13init() {
var map = new Array();
var s = "abcdefghijklmnopqrstuvwxyz";
for (var i = 0 ; i < s.length ; i++)
map[s.charAt(i)] = s.charAt((i+13)%26);
for (var i = 0 ; i < s.length ; i++)
map[s.charAt(i).toUpperCase()] = s.charAt((i+13)%26).toUpperCase();
return map;
}
function str_rot13(a,map) {
var s = "";
for (var i = 0 ; i < a.length ; i++) {
var b = a.charAt(i);
s += (b>='A' && b<='Z' || b>='a' && b<='z' ? map[b] : b);
}
return s;
}
</script>
</head>
<body>
<?php
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 = '<a href="contact/' . str_rot13($username[0]) . '+'
. $domain[0] . '+'
. $domain[1] . '.'
. $domain[2] .'" rel="nofollow">' . asc2html($emails[0][$i]) . '</a>';
} else {
$replace = '<a href="contact/' . str_rot13($username[0]) . '+'
. $domain[0] . '+'
. $domain[1] .'" rel="nofollow">' . asc2html($emails[0][$i]) . '</a>';
}
$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<br />\n
Sidewinder@extreme-hq.com";
echo cloakmail($content);
?>
</body>
</html>
22. May 2009
No Comments »