Hiding Email Address from Spammers

Anything questions related to styling should go in here.
Post Reply
User avatar
pasqo83
Posts: 106
Joined: Sat May 14, 2011 6:23 am

Hiding Email Address from Spammers

Post by pasqo83 »

Ive managed to hide the email address using php with the following code
<?php
function hide_email_adr($e)
{
    $piece = str_split(trim($e));
    $new_mail = '';

    foreach ($piece as $val)
    {
        $hidden_mail .= '&#'.ord($val).';';
    }

    return $hidden_mail;
}

?>

<?php echo hide_email_adr('myemail@somewhere.com'); ?>
However how do you hide the email address in the a href="mailto" so that spammers dont bombard me with emails.

Thanks in advnaced guys :D
  • Empty your mind, be formless like water. If you put water into a cup, it becomes the cup. You put water into a bottle and it becomes the bottle. You put it in a teapot it becomes the teapot. Now, water can flow or it can crash. Be water my friend.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Hiding Email Address from Spammers

Post by jacek »

I think you could do the same thing ? did you try it ?
Image
User avatar
pasqo83
Posts: 106
Joined: Sat May 14, 2011 6:23 am

Re: Hiding Email Address from Spammers

Post by pasqo83 »

Yeah I tried it and it works. :D

Just doesnt work when you go to do a href="mailto:email@somewhere.com" - that will still show.

Just thought there was a way, I've read up a few websites that it requires js coding to hide anchor links.
  • Empty your mind, be formless like water. If you put water into a cup, it becomes the cup. You put water into a bottle and it becomes the bottle. You put it in a teapot it becomes the teapot. Now, water can flow or it can crash. Be water my friend.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Hiding Email Address from Spammers

Post by jacek »

Does
<a href="mailto:<?php echo hide_email_adr('email@address.com'); ?>">Link</a>
not work though ?

I would have thought it would ;)

Either way spammers would still be able to decode this, so it might be better to have the server email you and create a contact form.
Image
User avatar
pasqo83
Posts: 106
Joined: Sat May 14, 2011 6:23 am

Re: Hiding Email Address from Spammers

Post by pasqo83 »

jacek wrote:Does
<a href="mailto:<?php echo hide_email_adr('email@address.com'); ?>">Link</a>
not work though ?
I would have thought it would ;)
Either way spammers would still be able to decode this, so it might be better to have the server email you and create a contact form.
Ah I never thought I could do it like that (still learning).
I get what you mean about that with the server emailing me with a contact form, but I think thats a bit to tecchie for me at the moment, i just need simplicity at the moment. :D
  • Empty your mind, be formless like water. If you put water into a cup, it becomes the cup. You put water into a bottle and it becomes the bottle. You put it in a teapot it becomes the teapot. Now, water can flow or it can crash. Be water my friend.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Hiding Email Address from Spammers

Post by jacek »

pasqo83 wrote:Ah I never thought I could do it like that (still learning).
Does it work, I'm just guessing :lol:
Image
User avatar
pasqo83
Posts: 106
Joined: Sat May 14, 2011 6:23 am

Re: Hiding Email Address from Spammers

Post by pasqo83 »

jacek wrote:
pasqo83 wrote:Ah I never thought I could do it like that (still learning).
Does it work, I'm just guessing :lol:
Hahaha, it does work!! woo hooo, thanks Jacek.

Only snag is when you hover over it, it does say the name of the email address but I can't be too picky, it doesn't show in the source code so I am happy with that :) :) :)
  • Empty your mind, be formless like water. If you put water into a cup, it becomes the cup. You put water into a bottle and it becomes the bottle. You put it in a teapot it becomes the teapot. Now, water can flow or it can crash. Be water my friend.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Hiding Email Address from Spammers

Post by jacek »

pasqo83 wrote:Hahaha, it does work!! woo hooo, thanks Jacek.
lucky guess ;)
pasqo83 wrote:Only snag is when you hover over it, it does say the name of the email address but I can't be too picky, it doesn't show in the source code so I am happy with that :) :) :)
No need to worry about that, unless the spam bot thing is actually a person with a browser they will not be able to see it as plain text. And if they are a person, they will be able to copy the email address from the mail window that opens anyway ;)
Image
Post Reply