473,394 Members | 1,640 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,394 software developers and data experts.

Hiding email addresses - rot13

Nel
Before I try and reinvent the wheel, can anyone help me with a basic routine
to hide email addresses from harvesting.

I currently use pull my page content from a db and run this ereg_replace:
$pagetext=ereg_replace('[A-Za-z0-9_]([-._]?[A-Za-z0-9])*@[A-Za-z0-9]([-.]?[A
-Za-z0-9])*\.[A-Za-z]+', '<a href="mailto:\\0"><font
color="#0000FF"><b>\\0</b></font></a>', $pagetext);

This simply replaces any emails within the page text with an <a> tag.

What I would like to do is replace it with:
<script language="JavaScript">
document.write(rot13('<n
uers=\"zn**@rknzcyr.pbz\">zn**@rknzcyr.pbz</n>'));
</script>

So, somehow I need to PHP's str_rot13() on the email addresses before the
ereg_replace. If anyone can suggest a solution I would be grateful.

Nel
Jul 17 '05 #1
8 2804
"Nel" <ne***@ne14.co.NOSPAMuk> wrote in message
news:r6*********************@wards.force9.net...
Before I try and reinvent the wheel, can anyone help me with a basic routine to hide email addresses from harvesting.

I currently use pull my page content from a db and run this ereg_replace:
$pagetext=ereg_replace('[A-Za-z0-9_]([-._]?[A-Za-z0-9])*@[A-Za-z0-9]([-.]?[A -Za-z0-9])*\.[A-Za-z]+', '<a href="mailto:\\0"><font
color="#0000FF"><b>\\0</b></font></a>', $pagetext);

This simply replaces any emails within the page text with an <a> tag.

What I would like to do is replace it with:
<script language="JavaScript">
document.write(rot13('<n
uers=\"zn**@rknzcyr.pbz\">zn**@rknzcyr.pbz</n>'));
</script>

So, somehow I need to PHP's str_rot13() on the email addresses before the
ereg_replace. If anyone can suggest a solution I would be grateful.

Nel


Use preg_replace_callback.
Jul 17 '05 #2
Nel
"Chung Leong" <ch***********@hotmail.com> wrote in message
news:3b********************@comcast.com...
"Nel" <ne***@ne14.co.NOSPAMuk> wrote in message
news:r6*********************@wards.force9.net...
Before I try and reinvent the wheel, can anyone help me with a basic

routine
to hide email addresses from harvesting.

I currently use pull my page content from a db and run this ereg_replace:

$pagetext=ereg_replace('[A-Za-z0-9_]([-._]?[A-Za-z0-9])*@[A-Za-z0-9]([-.]?[A
-Za-z0-9])*\.[A-Za-z]+', '<a href="mailto:\\0"><font
color="#0000FF"><b>\\0</b></font></a>', $pagetext);

This simply replaces any emails within the page text with an <a> tag.

What I would like to do is replace it with:
<script language="JavaScript">
document.write(rot13('<n
uers=\"zn**@rknzcyr.pbz\">zn**@rknzcyr.pbz</n>'));
</script>

So, somehow I need to PHP's str_rot13() on the email addresses before the ereg_replace. If anyone can suggest a solution I would be grateful.

Nel


Use preg_replace_callback.

I have looked at the PHP manual for preg_replace_callback and don't
understand how I can replace the text and then str_rot13 within the same
line. Can anyone offer a simple solution using my original ereg string?

Whilst I am at it, is there a better, quicker or easier way to hide an email
address from harvesters?

Nel
Jul 17 '05 #3
I noticed that Message-ID: <nG*********************@wards.force9.net>
from Nel contained the following:
Whilst I am at it, is there a better, quicker or easier way to hide an email
address from harvesters?


Yup. Use a response form.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #4
Nel
"Geoff Berrow" <bl******@ckdog.co.uk> wrote in message
news:72********************************@4ax.com...
I noticed that Message-ID: <nG*********************@wards.force9.net>
from Nel contained the following:
Whilst I am at it, is there a better, quicker or easier way to hide an emailaddress from harvesters?


Yup. Use a response form.


I would really like to keep the email address visible to the reader, but
make it hard for spambots.
<script language="JavaScript">
<!--
var name = "test";
var domain = "email.com";
document.write('<a href=\"mailto:' + name + '@' + domain + '\">');
document.write(name + '@' + domain + '</a>');
//-->
</script>

This would do if I could generate this on the fly from php.

Nel
Jul 17 '05 #5
I noticed that Message-ID: <DD*********************@wards.force9.net>
from Nel contained the following:
Yup. Use a response form.


I would really like to keep the email address visible to the reader, but
make it hard for spambots.
<script language="JavaScript">

Any solution requiring javascript will also make it hard for anyone
browsing with high security.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #6
Nel

"Geoff Berrow" <bl******@ckdog.co.uk> wrote in message
news:u1********************************@4ax.com...
I noticed that Message-ID: <DD*********************@wards.force9.net>
from Nel contained the following:
Yup. Use a response form.


I would really like to keep the email address visible to the reader, but
make it hard for spambots.
<script language="JavaScript">

Any solution requiring javascript will also make it hard for anyone
browsing with high security.


I must admit, I did worry about that a bit. What about a way to change the
email address in to html special chars?
e.g.
<a
href="mailto:%74%65%73%74%40%65%78%61%6d%70%6c%65% 2e%63%6f%6d">te&
#115;t@example.co&#1
09;</a>

I can write a script to do this where $email =
emailhide("te**@example.com"); but not sure how to do this for multiple
emails withing a text string.

Nel
Jul 17 '05 #7
I noticed that Message-ID: <Eq*********************@wards.force9.net>
from Nel contained the following:
Any solution requiring javascript will also make it hard for anyone
browsing with high security.


I must admit, I did worry about that a bit. What about a way to change the
email address in to html special chars?


Depends on what is being used to harvest the addresses. If a browser
can parse it then it's conceivable that this facility may be written
into the harvester. I'd say even more likely because such obfuscation
must mean a valid address.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #8
Regarding this well-known quote, often attributed to Nel's famous "Wed, 28
Apr 2004 11:02:43 +0100" speech:
"Geoff Berrow" <bl******@ckdog.co.uk> wrote in message
news:u1********************************@4ax.com...
I noticed that Message-ID: <DD*********************@wards.force9.net>
from Nel contained the following:
Yup. Use a response form.

I would really like to keep the email address visible to the reader, but
make it hard for spambots.
<script language="JavaScript">

Any solution requiring javascript will also make it hard for anyone
browsing with high security.


I must admit, I did worry about that a bit. What about a way to change the
email address in to html special chars?
e.g.
<a
href="mailto:%74%65%73%74%40%65%78%61%6d%70%6c%65% 2e%63%6f%6d">te&
#115;t@example.co&#1
09;</a>

I can write a script to do this where $email =
emailhide("te**@example.com"); but not sure how to do this for multiple
emails withing a text string.

Nel


I've always liked using a "gatekeeper" page. It's a simple form with a
button, maybe a textbox and a simple question. They fill it in, or just
click the button, they get the email address. I've even put some simple
onload javascript in there that automatically submits the form. People with
JS on just see a small blip before the page hits. Most spambots won't
bother with it, since time is money, and who cares.

--
-- 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 #9

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...
117
by: Steevo | last post by:
Any suggestions as to the best programs for cloaking email addresses? Many thanks -- Steevo
4
by: web_design | last post by:
I put this together from some other scripts I am using on a site. I'm trying to make a better email hiding script. It isn't working. Also, it causes Internet Explorer 6 SP2 to block the script...
15
by: Eirik | last post by:
This is a little function I wrote, inspired by the thread "Urgent HELP! required for Caesar Cipher PLEASE" $ cat /home/keisar/bin/c/ymse/rot13.h char rot13(char character) { int changed;...
3
by: me | last post by:
Is there code out there to truly hide email addresses from view source or spiders(crawlers etc). TIA Aaron
3
by: g0c | last post by:
hi, how to hide or replace email addresses in php mail function with something like "group" so the email addresses to which email is sent are not visible ? i have : $subs = "email1@dot.com,...
16
by: Andy Dingley | last post by:
I'm trying to write rot13, but to do it in a better and more Pythonic style than I'm currrently using. What would you reckon to the following pretty ugly thing? How would you improve it? In...
1
by: RLN | last post by:
I have a form that is set to "continuous forms" view. Several rows of data are shown to the user at the same time. I want to set FieldX and FieldY to true and show them only if the...
103
by: chochote | last post by:
Hi, I have a PHP script that does some processing, and stores an error message as a variable. The script then redirects to another script with the error string in the URL, with the second script...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.