Page 1 of 1
Hiding Email Address from Spammers
Posted: Mon May 30, 2011 10:05 pm
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
Re: Hiding Email Address from Spammers
Posted: Tue May 31, 2011 11:15 am
by jacek
I think you could do the same thing ? did you try it ?
Re: Hiding Email Address from Spammers
Posted: Tue May 31, 2011 11:32 am
by pasqo83
Yeah I tried it and it works.
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.
Re: Hiding Email Address from Spammers
Posted: Tue May 31, 2011 12:25 pm
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.
Re: Hiding Email Address from Spammers
Posted: Tue May 31, 2011 12:57 pm
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.
Re: Hiding Email Address from Spammers
Posted: Tue May 31, 2011 4:39 pm
by jacek
pasqo83 wrote:Ah I never thought I could do it like that (still learning).
Does it work, I'm just guessing
Re: Hiding Email Address from Spammers
Posted: Tue May 31, 2011 11:09 pm
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
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
Re: Hiding Email Address from Spammers
Posted: Wed Jun 01, 2011 8:30 am
by jacek
pasqo83 wrote:Hahaha, it does work!! woo hooo, thanks Jacek.
lucky guess
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