Skip to content

Instantly share code, notes, and snippets.

@ivuorinen
Created November 16, 2011 14:29
Show Gist options
  • Save ivuorinen/1370175 to your computer and use it in GitHub Desktop.
Save ivuorinen/1370175 to your computer and use it in GitHub Desktop.
rot13 php obfuscation
<script type="text/javascript">document.write(
"<?php
// We run str_rot13 to email link to conceil it from spam bots
// then we make it clear for browsers using javascript.
// If client doesn't have javascript installed, hide css: .ebg13 (= obfuscated .rot13)
echo str_rot13( "<a class='rot13' href='mailto:" . $email . "'>" . $email . '</a>' );
?>".replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);}));
</script>
<noscript>firstname.lastname@example.com</noscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment