• Sherman

    (@sdye557livecom)


    So I was recently looking over my site to make sure everything was working smoothly when I noticed that the contact page is broken. If I only partially fill out the form, it is supposed to highlight the necessary areas and inform the user they need to fill out the form properly. I also have some php security measures that were supposed to make sure the page didn’t get hacked. It seems these have been ineffective because when a user enters any information and clicks “submit”, it refreshes back to the home page with no notification whatsoever.

    When inspecting the source code, I find this Javascript added to the bottom of the page:
    (function(){try{var s,a,i,j,r,c,l=document.getElementsByTagName("a"),t=document.createElement("textarea");for(i=0;l.length-i;i++){try{a=l[i].getAttribute("href");if(a&&a.indexOf("/cdn-cgi/l/email-protection") > -1 && (a.length > 28)){s='';j=27+ 1 + a.indexOf("/cdn-cgi/l/email-protection");if (a.length > j) {r=parseInt(a.substr(j,2),16);for(j+=2;a.length>j&&a.substr(j,1)!='X';j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}j+=1;s+=a.substr(j,a.length-j);}t.innerHTML=s.replace(/</g,"<").replace(/>/g,">");l[i].setAttribute("href","mailto:"+t.value);}}catch(e){}}}catch(e){}})();
    How do I go about finding where the code is located, how do I remove it, and how do I prevent someone from adding similar (or the same) code in the future?

    Also, I did try deactivating all plugins, which did nothing, and I even deleted the page and content, removed the menu item, and then re-added everything from files on my computer (which don’t contain that code). When I refreshed the page and viewed the source code again, it was still there. So somewhere along the line it’s being added from a different file.

Viewing 1 replies (of 1 total)
  • I know your post is from almost a year ago, but just FYI: this code is inserted by CloudFlare. It is created by the Email Address Obfuscation feature (in your CloudFlare dashboard, you can find it under Scrape Shield and there your can toggle it on/off).

    What Email Address Obfuscation does:
    Encrypt email addresses displayed on your website to prevent harvesting by bots and spammers, without visible changes to the address for human visitors.

    I found your post because on one page my email address was visibly changed to [email protected], so I wondered what the code was about and found the answer on the web. So for anyone else stumbling across this post and looking for the answer to solve it: either turn the Email Address Obfuscation off in your CloudFlare dashboard, or leave it on and make an exception by putting your email between this code:
    <!–email_off–> <!–/email_off–>
    Example: <!–email_off–>example@wordpress.com<!–/email_off–>

    • This reply was modified 9 years, 3 months ago by JimGarrison.
Viewing 1 replies (of 1 total)

The topic ‘Added function breaks contact form’ is closed to new replies.