473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 2949
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hoang | last post by:
anyone know of an algorithm to filter out real email addresses as opposed to computer generated email addresses? I have been going through past email archives in order to find friends email...
8
by: JayB | last post by:
We sent out an email today to a list of subscribers from our database using ASP and CDO. For some reason, many people received it twice, including myself. I checked the database and there were do...
117
by: Steevo | last post by:
Any suggestions as to the best programs for cloaking email addresses? Many thanks -- Steevo
2
by: Doug | last post by:
I'm a little confused by this functionality. It doesn't seem to be behaving like it should. I am using the following regular expression to validate email addresses:...
6
by: Arun | last post by:
We have a Voting Poll system on our website where any site visitor can vote. we want to make sure that he does not cheat by submitting his vote multiple time or in any others ways. We...
1
by: Anonieko | last post by:
Understanding and Using Exceptions (this is a really long post...only read it if you (a) don't know what try/catch is OR (b) actually write catch(Exception ex) or catch{ }) The first thing I...
8
by: Cuthbert | last post by:
Hi folks, This question is a little deep into memory management of microprocessor. How do we know the memory arrangement using in microprocessors? Top-Bottom or Bottom-Top? For example, the...
0
by: Larry D | last post by:
I have a client with a site that users can register at, we collect their emails, if they have one, in an Access db. I have a page that uses CDOSYS to send messages to those emails but I am getting...
5
by: lancer6238 | last post by:
Hi all, I'm trying to send and receive a structure array "TABLE". I tried using MPI_Type_struct but I got "Segmentation fault" when the processor (P1) is supposed to receive the structure. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.