protect email address from spiders

Discussion in 'Web Design & Coding' started by muzikool, Jun 15, 2004.

  1. muzikool

    muzikool Act your wage. Political User

    I understand that you can code your email in such a way on a web page so that it can't be picked up by a web spider. So what is the best way to do it and can someone post the code I need to use?
     
  2. ~bk

    ~bk I Political User

    Messages:
    3,768
    Location:
    Canada
    You mean so you don't get spam, right?
     
  3. NetRyder

    NetRyder Tech Junkie Folding Team

    Messages:
    13,256
    Location:
    New York City
    One way is to use something like: netryder [at] osnn [dot] net
    However, certain bots have learned to overcome tricks like this. Another more effective way is to type the address into an image, and use the image in place of the address.
     
  4. ~bk

    ~bk I Political User

    Messages:
    3,768
    Location:
    Canada
    What if you use a PHP Mail Form? Would you receive spam?
     
  5. NetRyder

    NetRyder Tech Junkie Folding Team

    Messages:
    13,256
    Location:
    New York City
    If the actual email address isn't displayed in the HTML code that's generated, no...the bots won't be able to pick it up.
     
  6. ~bk

    ~bk I Political User

    Messages:
    3,768
    Location:
    Canada
    Ohh.. ok. Thanks.
     
  7. muzikool

    muzikool Act your wage. Political User

    Yeah, mainly to prevent spam. I don't know anything about the PHP Mail Form. I found out that javascript can be used to make it work. Is this an effective way?
     
  8. leedogg

    leedogg Gojyone kawaiiiiiiii!

    Messages:
    820
    <!-- Begin No Spam -->
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    var user;
    var domain;
    var suffix;
    function jemail(user, domain, suffix){
    document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '">' + user + '@' + domain + '.' + suffix + '</a>');
    }
    // End -->
    </script>
    <!-- End No Spam -->

    Then in the <BODY> section, insert this where you want your email address(es) to appear:

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    jemail("yourname", "yourdomain", "tld");
    // End -->
    </script>

    Replace "yourname" with your email name, "yourdomain" with your domain name and "tld" with "com," "net," "org" or what ever. For example, jemail("joe","blow","com") will display as joe@blow.com, a fully functional link.
     
  9. NetRyder

    NetRyder Tech Junkie Folding Team

    Messages:
    13,256
    Location:
    New York City
    That's possible too...you would use something like this:
    http://www.blazonry.com/javascript/js_hiding.php

    EDIT: It's pretty much the same thing leedogg just posted.
     
  10. leedogg

    leedogg Gojyone kawaiiiiiiii!

    Messages:
    820
    muzikool likes this.
  11. NetRyder

    NetRyder Tech Junkie Folding Team

    Messages:
    13,256
    Location:
    New York City
    [​IMG] [​IMG]
     
  12. muzikool

    muzikool Act your wage. Political User

    Thanks leedogg and NetRyder. :)

    Another thing, what code do I add to the javascript in <body> in order to specify the font, size, and color of the text displayed?
     
  13. j79zlr

    j79zlr Glaanies script monkey Political User

    Messages:
    2,725
    Location:
    Chicago
    This used to work, not sure if they've fixed it, probably have, but I dont get any spam from my email address. use iso codes,

    sample@example.org

    is

    &#115;&#97;&#109;&#112;&#108;&#101;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#111;&#114;&#103;
     
  14. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    the bots read the iso codes now

    PHP:
    <?php
    // My Email Address
    $myEmail "email@mydomain.com";

    // Additional Email Headers
    $emailHeader "From: {$_POST['fromEmail']}\r\n";
    $emailHeader .= "Content-type: text/plain\r\n";
    $emailHeader .= "X-mailer: PHP v" phpversion();

    // Send The Email
    $email mail($my_email$_POST['subject'], $_POST['message'], $emailHeader);

    if (
    $email) {
    echo 
    "Email Sent";
    } else {
    echo 
    "Email Failed";
    }
    This assumes a web form which has at least three fields
    a input[text] section with its name set to "fromEmail"
    a input[text] section with its name set to "subject"
    a textarea with its name set to "message"
     
  15. muzikool

    muzikool Act your wage. Political User

    Still wondering how to code for text size, color, and font within the javascript for use with what leedogg posted earlier. I don't want the address displayed blue and underlined.
     
  16. Or you could do it as such:

    me -at- domain -dot- com
     
  17. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    the spiders will no doubt learn how to read it in that format as well, they soon may be able to understand how to parse the javascript for the information they are looking for
     
  18. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    They can parse anything, keep in mind the people who invent the robots are internet users also, and therefore know the methods used to try and deter their own robots.

    They can even read images and have now been made 'intelligent' so they can learn and post to almost any HTML form. It is quite a pain in the ass, however robots are being used less and less in favour of either huge lists or randomly generated names.