MethylBlue
  1. Filelight
  2. Codeine
  3. Wocka
  4. Blog
  5. Detritus
  6. Home

Emunger

Generate this:

<a href="mailto:fred@example.com">fred@example.com</a>

Using this:

<script type="text/Javascript">var ui='lto';var ofbq='&#102;&#114;&#101;&#100;&#x';var rd='http://';var xc='40;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;';var flaj='&#102;&#114;&#101;&#100;&#x';var md='do_ajax()';var xzko='40;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;';document.write('<a href="mai'+ui+':'+ofbq+xc+'">'+flaj+xzko+'</a>');</script><NOSCRIPT>Please enable Javascript :(</NOSCRIPT>

Try it out!

e.g. fred@example.com 

Source code for arbiturary email addresses

<?php /* >=4 */

/** Copyright 2008 Max Howell <www.methylblue.com>
  * Licensed as defined by the GNU General Public License version 3 */

function uniqueRandomTokens$n$min 2$max )
{
    
$tokens = array(); // warning--

    
for ($i 1$i <= $n$i++) {
        
$length rand$min$max );
        
$token '';
        for (
$j 0$j $length; ++$j)
            
$token .= chrrand97122 ) );

        while (
in_array$token$tokens ))
            
$token .= chrrand97122 ) );

        while (
in_array$token, array( 'if''for''var''do''while' ) ))
            
$token .= chrrand97122 ) );

        
$tokens"v$i" ] = $token;
    }

    return 
$tokens;
}


/** @returns JavaScript to render <a href='mailto:$address'>$text</a>
  */
function print_emunger$address$text '' )
{
    
// split around the @ symbol, then split the hex entity of that too
    
$n strpos$address'@' );
    
$x1 toHtmlEntitiessubstr$address0$n ) );
    
$x2 toHtmlEntitiessubstr$address$n ) );
    
$x1 "$x1&#x";
    
$x2 "40;$x2";

    if (
$text == '') {
        
$x3 $x1;
        
$x4 $x2;
    }
    elseif ((
$n strpos$text'@' )) === false) {
        
// no @ symbol so do a 50/50 split
        
$n strlen$text );
        
$x3 toHtmlEntitiessubstr$text0$n ) );
        
$x4 toHtmlEntitiessubstr$text$n ) );
    }
    else {
        
$x4 toHtmlEntitiessubstr$text$n ) );
        
$x3 toHtmlEntitiessubstr$text0$n ) );
        
$x3 "$x3&#x";
        
$x4 "40;$x4";
    }

    
extractuniqueRandomTokens) );

    echo 
'<script type="text/Javascript">'.
        
"var $v1='lto';".
        
"var $v2='$x1';".
        
"var $v6='http://';".
        
"var $v3='$x2';".
        
"var $v4='$x3';".
        
"var $v7='do_ajax()';".
        
"var $v5='$x4';".
        
"document.write('<a href=\"mai'+$v1+':'+$v2+$v3+'\">'+$v4+$v5+'</a>');".
        
'</script>';
}

?>