1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
<!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"> //<![CDATA[ window.onload = function () { geo(); } function geo() { if (!document.getElementsByTagName) // Check for browser support 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)); // Add mailto link anchor.innerHTML = linktext; // IE Fix } } 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> |
Tags: email, JavaScript, obfuscator, PHP

Fri, May 22, 2009
JavaScript, PHP, Snippets