469,891 Members | 2,139 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,891 developers. It's quick & easy.

using php to protect email addresses

Hello,
I'm creating a site that has several contact email addresses. These are
vlid addresses, i'm wondering if i can use php to alter these addresses so
that spam harvesters can't get them, yet a normal user clicking on them can?
Thanks.
Dave.
Jul 17 '05 #1
10 2681
"dave" <dm*******@woh.rr.com> wrote in message
news:XU*******************@fe2.columbus.rr.com...
Hello,
I'm creating a site that has several contact email addresses. These are vlid addresses, i'm wondering if i can use php to alter these addresses so
that spam harvesters can't get them, yet a normal user clicking on them can? Thanks.
Dave.


The method I use, and PHP.net uses, is to str_replace "@" with " at " and
"." with " dot ".

So me@mysite.com would be displayed like this:

me at mysite dot com

You may want to consider only displaying the email address, and not making
it an actual link, to ensure that any spiders looking for e-mail addresses
can't get the addresses you have. It makes it more of a hassle for the user
to have to open their e-mail account and type in the e-mail manually instead
of just clicking on a link, but in the end it's safer.
Jul 17 '05 #2
"kingofkolt" <je**********@comcast.net> wrote in message news:<U9pKc.104959$a24.22251@attbi_s03>...
"dave" <dm*******@woh.rr.com> wrote in message
news:XU*******************@fe2.columbus.rr.com...
Hello,
I'm creating a site that has several contact email addresses. These

are
vlid addresses, i'm wondering if i can use php to alter these addresses so
that spam harvesters can't get them, yet a normal user clicking on them

can?
Thanks.
Dave.


The method I use, and PHP.net uses, is to str_replace "@" with " at " and
"." with " dot ".

So me@mysite.com would be displayed like this:

me at mysite dot com

You may want to consider only displaying the email address, and not making
it an actual link, to ensure that any spiders looking for e-mail addresses
can't get the addresses you have. It makes it more of a hassle for the user
to have to open their e-mail account and type in the e-mail manually instead
of just clicking on a link, but in the end it's safer.


why not keep the adresses in the php part of the script (and invisible
to any 'collectors') and using a form and mail() to send mails without
showing adresses at all?

micha
Jul 17 '05 #3
some one else may be able to shed some light on this, but I have seen a
fairly short java script that seperates the email address up untill you
click the link then it puts it together and it works like a mail to
link, so if you go through the code you can't see an email address.

J.
dave wrote:
Hello,
I'm creating a site that has several contact email addresses. These are
vlid addresses, i'm wondering if i can use php to alter these addresses so
that spam harvesters can't get them, yet a normal user clicking on them can?
Thanks.
Dave.

Jul 17 '05 #4
On Sun, 18 Jul 2004 20:10:17 +1000, James Smith wrote:
some one else may be able to shed some light on this, but I have seen a
fairly short java script that seperates the email address up untill you
click the link then it puts it together and it works like a mail to
link, so if you go through the code you can't see an email address.

J.

Bad idea. I surf normally with JS disabled =)

You can encode an address:
function email_encode($addy, $mail_label) {
for ($i = 0; $i < strlen($addy); $i++) {
if(preg_match('/\w/', $addy[$i])) {
$enc_addy .= '%' . bin2hex($addy[$i]);
} else {
$enc_addy .= $addy[$i];
}
}

for ($i = 0; $i < strlen($mail_label); $x++) {
$enc_mail_label .= '&#x' . bin2hex($mail_label[$i]).';';
}

return '<a href="mailto:' . $enc_addy .'">' . $enc_mail_label . '</a>';
}

$mail_addy = email_encode('f**@bar.com', 'foobar');


Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/

Jul 17 '05 #5
"chotiwallah" <ch*********@web.de> wrote in message
news:78*************************@posting.google.co m...
"kingofkolt" <je**********@comcast.net> wrote in message

news:<U9pKc.104959$a24.22251@attbi_s03>...
"dave" <dm*******@woh.rr.com> wrote in message
news:XU*******************@fe2.columbus.rr.com...
Hello,
I'm creating a site that has several contact email addresses. These
are
vlid addresses, i'm wondering if i can use php to alter these
addresses so that spam harvesters can't get them, yet a normal user clicking on

them can?
Thanks.
Dave.


The method I use, and PHP.net uses, is to str_replace "@" with " at " and "." with " dot ".

So me@mysite.com would be displayed like this:

me at mysite dot com

You may want to consider only displaying the email address, and not making it an actual link, to ensure that any spiders looking for e-mail addresses can't get the addresses you have. It makes it more of a hassle for the user to have to open their e-mail account and type in the e-mail manually instead of just clicking on a link, but in the end it's safer.


why not keep the adresses in the php part of the script (and invisible
to any 'collectors') and using a form and mail() to send mails without
showing adresses at all?

micha


This would be a good option, but a mail server might not be available to
dave. Also, some users want to know contact e-mail addresses for future
reference.

- JP
Jul 17 '05 #6
While the city slept, kingofkolt (je**********@comcast.net) feverishly
typed...

[contact form]
This would be a good option, but a mail server might not be available
to dave.
Many hosts and ISP's have a generic form-to-mail script for their clients to
use. He could also use a remotely-hosted service like Response-o-matic:
http://www.response-o-matic.com/
Also, some users want to know contact e-mail addresses for
future reference.


They would be in the reply that you send them.

Cheers,
Nige

--
Nigel Moss
http://www.nigenet.org.uk
Mail address not valid. ni***@DOG.nigenet.org.uk, take the DOG. out!
In the land of the blind, the one-eyed man is very, very busy!
Jul 17 '05 #7
"nice.guy.nige" wrote:
While the city slept, kingofkolt (je**********@comcast.net) feverishly
typed...

[contact form]
This would be a good option, but a mail server might not be

available
to dave.


Many hosts and ISPís have a generic form-to-mail script for
their clients to
use. He could also use a remotely-hosted service like
Response-o-matic:
http://www.response-o-matic.com/
Also, some users want to know contact e-mail addresses for
future reference.


They would be in the reply that you send them.

Cheers,
Nige


Sometimes simple (and cute ideas) are the best. I like Nigelís email
address with the phrase íDOG.í in it. If anyone wants to legitmately
contact him, they would have no problem at all.

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-protect-...ict130542.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=435780
Jul 17 '05 #8
.oO(dave)
I'm creating a site that has several contact email addresses. These are
vlid addresses, i'm wondering if i can use php to alter these addresses so
that spam harvesters can't get them, yet a normal user clicking on them can?


Forget about Javascript crap or any other kind of "encryption" (@ -> at,
.. -> dot, decimal character references etc.), it's too easy to break
them with regular expressions. And the more difficult you make it for
the harvester, the more difficult it will also be for a real user.

I think your best chance is to use a simple form, so the user has to
press a button to see the mail-addresses (maybe after entering a kind of
randomly created pin-code). Bots are (hopefully) not capable of handling
such "forced" interactivity.

Micha
Jul 17 '05 #9
dave wrote:
Hello,
I'm creating a site that has several contact email addresses.
These are vlid addresses, i'm wondering if i can use php to alter
these addresses so that spam harvesters can't get them, yet a normal
user clicking on them can? Thanks.
Dave.


Use a form, with a select box with the recepients:

<form action="form_handler.php" method="post">
<select name="recep">
<option value="0">Recepient 1</option>
<option value="1">Recepient 2</option>
<option value="2">Recepient 3</option>
<option value="3">Recepient 4</option>
</option>
...
</form>

Then, in the form_handler.php:

$recipients = array('r***@yourdomain.com', 'r***@yourdomain.com'...);
$mail_to = $recipients[$_POST['recep']];
--
If the Internet is a Marx Brothers movie, and Web, e-mail, and IRC are
Groucho, Chico, and Harpo, then Usenet is Zeppo.
Jul 17 '05 #10
Regarding this well-known quote, often attributed to Michael Fesser's
famous "Mon, 19 Jul 2004 14:56:44 +0200" speech:
.oO(dave)
I'm creating a site that has several contact email addresses. These are
vlid addresses, i'm wondering if i can use php to alter these addresses so
that spam harvesters can't get them, yet a normal user clicking on them can?


Forget about Javascript crap or any other kind of "encryption" (@ -> at,
. -> dot, decimal character references etc.), it's too easy to break
them with regular expressions. And the more difficult you make it for
the harvester, the more difficult it will also be for a real user.

I think your best chance is to use a simple form, so the user has to
press a button to see the mail-addresses (maybe after entering a kind of
randomly created pin-code). Bots are (hopefully) not capable of handling
such "forced" interactivity.

Micha


I'll second that. I have something like that on my contacts page at
http://www.voterudy.org . It's basically just a button that says "click
here for email address", and when you click there it rerenders the page
with the email in plaintext.

To make it even simpler, I have a JavaScript set up that automatically
"clicks the button" and submits the PHP form. Sure, a spambot *could* get
around it... easily, even... but it's just not worth it, since it's a
nonstandard method, and there's so many other ripe-for-the-picking email
addresses out there.

--
-- Rudy Fleminger
-- sp@mmers.and.evil.ones.will.bow-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com
Jul 17 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Hoang | last post: by
8 posts views Thread by JayB | last post: by
117 posts views Thread by Steevo | last post: by
6 posts views Thread by Arun | last post: by
1 post views Thread by Anonieko | last post: by
5 posts views Thread by lancer6238 | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.