ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Obfuscating commenter e-mail (Solved. Author apologies for dimness.)

February 18, 2008 10:22am

Subscribe [3]
  • #1 / Feb 18, 2008 10:22am

    bikesarefun

    11 posts

    This seems like a basic thing, but I can’t find any tips ...

    How can I obfuscate commenters’ e-mail to protect them from spam? Unless they have a URL, I’d like their name to link to their e-mail in order to promote accountability. (I only allow members to comment.)

    Currently I’m doing this:

    {if url}<a href="http://{url}">{if:else}<a href="mailto:{email}">{/if}{name}</a>

    Is there an elegant way to swap out the @ in the email with a simple Turing test or something?

  • #2 / Feb 18, 2008 10:38am

    silenz

    1651 posts

    Check out {url_or_email_as_author}

    The email ought to be obfuscated with javascript by default.

  • #3 / Feb 18, 2008 10:41am

    bikesarefun

    11 posts

    Near as I can tell it’s not.

    Here’s a sample output: http://www.chicagobikeracing.com/index.php/site/post/a_few_changes/#comments

  • #4 / Feb 18, 2008 10:44am

    bikesarefun

    11 posts

    Duh. I just needed to use {url_or_email_as_author}

    Nevermind! Thanks!

  • #5 / Feb 18, 2008 10:48am

    allgood2

    427 posts

    The email address looks obfuscated to me. Looking at the view source, for the comment made be Rooster displays this:

    <div class="comment">
    
    
    <div class="comment_name"><b>
    //<![CDATA[
    var l=new Array();
    l[0]='>';l[1]='a';l[2]='/';l[3]='<';l[4]=' 114';l[5]=' 101';l[6]=' 116';l[7]=' 115';l[8]=' 111';l[9]=' 111';l[10]=' 82';l[11]='>';l[12]='\"';l[13]=' 109';l[14]=' 111';l[15]=' 99';l[16]=' 46';l[17]=' 114';l[18]=' 101';l[19]=' 105';l[20]=' 114';l[21]=' 117';l[22]=' 111';l[23]=' 99';l[24]=' 114';l[25]=' 97';l[26]=' 116';l[27]=' 115';l[28]=' 114';l[29]=' 117';l[30]=' 111';l[31]=' 102';l[32]=' 64';l[33]=' 102';l[34]=' 102';l[35]=' 101';l[36]=' 106';l[37]=':';l[38]='o';l[39]='t';l[40]='l';l[41]='i';l[42]='a';l[43]='m';l[44]='\"';l[45]='=';l[46]='f';l[47]='e';l[48]='r';l[49]='h';l[50]='a ';l[51]='<';
    for (var i = l.length-1; i >= 0; i=i-1){ 
    if (l[i].substring(0, 1) == ' ') [removed]("&#"+unescape(l[i].substring(1))+";"); 
    else [removed](unescape(l[i]));
    }
    //]]>
    </b> |  Feb 17, 2008 | <a href="http://www.chicagobikeracing.com/index.php/site/post/931/name=3410&gt&lt/a&gt&lta">8://55 pm</a></div>
    First of all, the Terms and Conditions are hilarious.
    
    
    I just looked over the new team site and it looks really good. Keep up the good work.
    
    </div>

    A javascript obfuscation. The mouseover displays the email, as normal.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases