Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

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

0 Members and 1 Guest are viewing this topic.

artistsinhawaii

  • 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.)

Quote
// 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  => dennis54321@yahoo.com

function FixBusi (obj1) { 
var tmp;
  if (obj1.business) {     
    tmp = obj1.business.value;
    obj1.business.value = 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  => dennis54321@yahoo.com

and replaces it with

real URL =>  made+inhawaii+@+compuserve+.+com => madeinhawaii@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

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

Add

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


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

Quote
<a onclick="FixMail (this);"href="mailto:dennis54321@yahoo.com">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:
Quote
<?php
echo <<<EOT

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

<div align="center"><span class="footer"><a onclick="FixMail (this);"href="mailto:dennis54321@yahoo.com"><font face="arial" size="3">Contact Evj Art and Photography</font></a></span></div>
EOT;
?>
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 dennis54321@yahoo.com 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.

Dennis

(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:

Quote
function FixMail (obj1) {   
addrvar tmp;

Should have been:

Quote
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:  http://www.artistsinhawaii.com/evj/  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 »
Logged
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.

mywedding

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

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

Page created in 0.018 seconds with 20 queries.