Added function breaks contact form
-
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.
The topic ‘Added function breaks contact form’ is closed to new replies.