Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.


Results 1 to 4 of 4

Thread: hiding email address

  1. #1

    hiding email address

    ok.. can someone tell me if this method of hiding the email address from spam bots will work?
    basically, the idea is to create a link, make that link open a new page, and let the new page output the email address...

    so there will be 2 files.. "request_email.php" and "print_email.php"

    in "request_email.php":
    HTML Code:
    <a href="print_email.php?d=domain&n=myEmailAddress&end=com">The Link</a>
    in "print_email.php":
    PHP Code:
    $nm $_GET['n'];
    $e $_GEt['end'];
    $at "@";
    $dot ".";

    $theAdd $nm $at $dm $dot $e;
    $theAdd// myEmailAddress@domain.com
    am i on the right path? or am i being stupid and missing something?

  2. #2
    The spam bot will just follow the link to a correctly outputted email address.

    The correct thing todo is leave the email in plain sight and set up good spam filters. No need to mess up the users experience just because you don't want spam.

  3. #3
    Ajcates is right. PHP is not some mystical program that can hide stuff from the webcrawlers. At the end of the day, PHP generates HTML.

    Option 1:
    Replace your email text with images. Open up Photoshop and type in "name@domain.com" and export it.

    Option 2:
    Write your emails in such a way that it'll confuse the crawlers.
    • nameATdomainDOTcom
    • name {at} domain [no spam] com
    Last edited by NeoDreamer; October 11th, 2009 at 08:52 PM.

  4. #4
    You can obfuscate the email address. Wordpress has a nice function: http://codex.wordpress.org/Function_...ce/antispambot which is located in
    Here are the functions you'll need to get it to work standalone:
    PHP Code:
    function zeroise($number$threshold) {

    antispambot($emailaddy$mailto=0) {
    $emailNOSPAMaddy '';
    srand ((float) microtime() * 1000000);
        for (
    $i 0$i strlen($emailaddy); $i $i 1) {
    $j floor(rand(01+$mailto));
            if (
    $j==0) {
    $emailNOSPAMaddy .= '&#'.ord(substr($emailaddy,$i,1)).';';
            } elseif (
    $j==1) {
    $emailNOSPAMaddy .= substr($emailaddy,$i,1);
            } elseif (
    $j==2) {
    $emailNOSPAMaddy .= '%'.zeroise(dechex(ord(substr($emailaddy$i1))), 2);
    $emailNOSPAMaddy str_replace('@','@',$emailNOSPAMaddy);

    to use it all you'd do is:

    PHP Code:
    it will display as 'youremail@email.com' but the source, which is what bots see, will be randomly obfuscated to make it harder for bots to figure it out.

    I know lots of ppl who do:
    Quote Originally Posted by NeoDreamer View Post
    Option 2:
    Write your emails in such a way that it'll confuse the crawlers.
    • nameATdomainDOTcom
    • name {at} domain [no spam] com
    and it does work pretty well, the only downside that I've found is that it also confuses potential clients, crazy ... i know
    Let us live so that when we come to die even the undertaker will be sorry. - Mark Twain
    Don't PM me your CSS, xHTML, JS or PHP questions. I will not reply to ANY IE6 questions.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About kirupa.com Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012