Why should I rely on PHPJabbers.com for all my PHP scripting needs? What do you offer me when buying some script?
  • Top quality scripts
  • Full demo before buying
  • Best pricing
  • Script customization
  • 7 days a week support
  • Installation support
  • Secure buying
  • Protect email address from spam bots

    posted on 2006-10-31 20:02:12

    Protecting your email addresses from spam bots is the thing that you should do after making your web forms using the CAPTCHA verification script. You probably know that spam bots are used to visit your web site pages and extract all email address that can be found there. Usually a refular expression is used to match all email address. Using a simple JavaScript function you can make your email address "invisible" to spam bots but still visible for your web site visitors. I've created a JavaScript function that takes 4 parameters and builds a clickable email link.

    <script language="javascript">
    function emailantispam(email1, email2, email3, email4){
       emailE = email1 + email2 + '@' + email3 + email4;
       document.write('<a href="mailto:' + emailE + '">' + emailE + '</a>')
    };
    </script>

    Now, assume that your email address is TomRogers@yahoo.com. When you want to have a clickable email on your web pages you use this:

    <a href="mailto:tomrogers@yahoo.com">tomrogers@yahoo.com</a>

    However, the email address is listed as a plain text and every spam bot can easily find it out. Using the above JavaScript function you can still have a clickable email address on your web page but spam bots will not be able to find it out. All you need to use is:

    <script language="javascript">emailantispam('tom','rogers','yah','oo.com');</script>

    The emailantispam() function will build an email address using the 4 parameters you pass to it.

    Comments
    manohar posted on 2008-02-14 11:49:16
    Please how i can avoid the spamming in sending emails form and insert query in database.
    I got daily 20 t0 25 and more mails are spamming in mails. and stored in a database.

    mink posted on 2008-01-19 00:39:11
    Try it.

    alice posted on 2007-08-17 01:22:00
    on my contact i added the above but and placed "&#064" to further confuse spam. on the second java script. but on the site it has both addresses. what do i need to do to change or correct. and i wanted an' info@smartitag.com as well.
    also is my top and bottom java in the right place. thankyou for your assistance

    Kevin posted on 2007-02-05 07:32:40
    Total newbie. Where do I put each script reference in the webpage? The function script goes where? Can this script be saved as a separate js file and referenced to it with the secondary script?
    ----------------------
    Veselin: JavaScript function can be in separate file but you need to include the file in the head tag of your web pages. Then on the places where you want email address to appear you can put the function reference.

    nirz posted on 2006-12-22 02:06:55
    is it possible for you to give a working example of this. I am not sure where the codes go and what is my address is, say, "info@mydomainname.com" as opposed to yahoo.com?
    Thank you.
    --------------------------------
    Veselin Stoilov:
    you can use <br />
    &lt;script language=&quot;javascript&quot;&gt;emailantispam('in','fo','mydomain','name.com');&lt;/script&gt;
    --------------------------------
    nirz: oops! The email address is now showing up at the top left hand side of the contact.html page (where the contact form is). Did I put the Javascript line in the wrong place?
    --------------------------------
    Veselin: most probably YES :) it needs to be where you want the email to appear

    Pages:   1
       
    If you have any additions, suggestions or modifications for this example please send an email to or use the form below.
       
    Your name:
    Your email: (email address will not be posted on the web site)
    Comment:
    Verification