Advanced search  


cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.

Pages: [1]   Go Down

Author Topic: Simple, invisible, protection of your email against spammers and robots  (Read 13813 times)

0 Members and 1 Guest are viewing this topic.


  • VIP
  • Coppermine addict
  • ***
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 856
    • evj art and photography

I found this on a public domain and reworked it a bit.  This javascript allows you to put a fake email address in your website and replaces it when your user clicks on the "contact us", or similar link, with your real email address. Your real emal address resides in bits and pieces in this JavaScript making it imposible for robots to read it.    It then concatenates the bits of your real email to recreate your true email address.  (NOTE: It will not prevent real, live, individuals from copying down your real address, one at a time.)

// global variables to form MY addresses
var at1 = "@";
var dot = ".";
var typ = "com";
var id1 = "made";    // real id1
var id2 = "inhawaii";    // real id2
var url = "compuserve";       // real URL
var fid1 = "dennis";      // fake id1
var fid2 = "54321"    // fake id2
var furl = "yahoo";    // fake URL =>  dennis+54321+@+yahoo+.+com  =>

function FixBusi (obj1) { 
var tmp;
  if ( {     
    tmp =; = id1 + id2 + at1 + url + dot + typ;
  return true;           

function FixLink (obj1) {
var tmp,org,ary=new Array();
  for (i=0; i<obj1.length; i++) { 
    obj = obj1.elements;       
    org = obj.value;
    tmp = org;  // place holder
    ary = tmp.split (furl); 
    if (ary.length > 1) {   
      tmp = ary.join ("members." + url);
      obj.value = tmp;

    org = tmp; 
    ary = tmp.split (fid1 + fid2);
    if (ary.length > 1) {   
      tmp = ary.join (id1 + id2);
      obj.value = tmp;


function FixMail (obj1) {   
var tmp;
  tmp = obj1.href;
  obj1.href = "mailto:" + id1 + id2 + at1 + url + dot + typ;

  return true;             

What it does is. 1st it takes your fake address:

fake URL =>  dennis+54321+@+yahoo+.+com  =>

and replaces it with

real URL =>  made+inhawaii+@+compuserve+.+com =>

then opens your default email form with your real address.

To install:  Save the above routine as spamguard.js and put it in your coppermine root directory.

Then, just under this line in your theme's template.html file

<script type="text/javascript" src="scripts.js"></script>


<script type="text/javascript" src="spamguard.js"></script>

Change your contact email address in your files using this format: 

<a onclick="FixMail (this);"href="">Contact Us</a>
Make certain to use the same fake address everywhere.

NOTE:  CPG1.4x users can simply modify their myfooter.php file to look something like this:
echo <<<EOT

<script type="text/javascript" src="spamguard.js"> </script>

<div align="center"><span class="footer"><a onclick="FixMail (this);"href=""><font face="arial" size="3">Contact Evj Art and Photography</font></a></span></div>
If your myfooter.php file is set in your CONFIG menu, it will affect all themes without having to add the js script line to each and every template.

Spambots will read as the site's emal address, and this would be a fake address.  Real people clicking on your "contact us", however will end up with an email form with your real address on it.  Ideally, you would use a real email address as your fake one, create one just for this purpose at yahoo or hotmail to monitor who is lifting your email for spam purposes. 

And, please, NEVER use someone else's real email address.  No matter how much you may not like them.


(Just so you know, both addresses above are fake)

NOTE:  11-14-05 There was a bit of a cut and paste error earlier on this post. Where:

function FixMail (obj1) {   
addrvar tmp;

Should have been:

function FixMail (obj1) {   
var tmp;

So if you tried this and it didn't work.  Please try again.

You can see this in action at:  Just pass your mouse over the Contact Evj art and Photography  link at the bottom of the page, and you should see the fake email address in your status bar.  Click on it and it should open a page to my real address. After that, as long as you remain on the same page, hovering over my link will display my real address in the status bar.  Change to a different page, and it reverts to the fake address in the status bar.

« Last Edit: November 15, 2005, 09:31:09 am by madeinhawaii »
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.


  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Female
  • Posts: 42
  • MyWedding
    • Wedding

great job, thx :)
Dreams are free, so free your dreams, "Astrid Alauda"
Pages: [1]   Go Up

Page created in 0.023 seconds with 20 queries.