Go Back   Trackpads Community > General Discussions > Computer and Technology > Web Design

Web Design Forums and discussions on webdesign

Web Design

Reply
 
LinkBack Thread Tools
Old 12-22-2004, 10:00   #1 (permalink)
Kerberos
Civilians

 
Default Hiding email address from spambots

Neat article on how to hide e-mail addresses from spambots:
http://www.phoenity.com/newtedge/hide_email_spambots/
To date I have always used a Javascript, but it doesn't work with XHTML,
however this CSS hack works fine with XHTML, and will protect e-mail
addresses from being collected.

--

Kerberos.

http://www.opera.com
http://www.freebsd.org
http://www.auriance.com
http://www.osresources.com
http://exodus.jabberstudio.org
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Trackpads Information
Click to Visit
Old 12-22-2004, 10:00   #2 (permalink)
Steve Pugh
Civilians

 
Default Re: Hiding email address from spambots

On Wed, 22 Dec 2004 1135 -0200, Kerberos <me@privacy.net> wrote:

>Neat article on how to hide e-mail addresses from spambots:
>http://www.phoenity.com/newtedge/hide_email_spambots/
>To date I have always used a Javascript, but it doesn't work with XHTML,
>however this CSS hack works fine with XHTML, and will protect e-mail
>addresses from being collected.


As IE doesn't currently support the CSS used, this technique is of
very little use on today's web.

Steve

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-22-2004, 19:00   #3 (permalink)
Justin Koivisto
Civilians

 
Default Re: Hiding email address from spambots

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kerberos wrote:
| Neat article on how to hide e-mail addresses from spambots:
| http://www.phoenity.com/newtedge/hide_email_spambots/
| To date I have always used a Javascript, but it doesn't work with
| XHTML, however this CSS hack works fine with XHTML, and will protect
| e-mail addresses from being collected.
|

I've had good luck so far with this:

/**
* emailEncode
*
* Spits out email addresses using HTML entities instead of the actual
* characters as an attempt to prevent spam to these addresses.
* Searches for email addresses, links them, and encodes them.
*
* @param $x The content that contains the email address(es)
* @result Returns the input with addresses encoded
*/
function emailEncode($x){
~ $pattern='/([a-z][a-z0-9_.-\/\%]*@[^\s\"\)\?<>]+\.[a-z]{2,6})/i';
~ $search=array();
~ $replace=array();
~ if(preg_match_all($pattern,$x,$matches)){
~ if(isset($matches[0])){
~ // There should be at least one match from the string.
~ for($i=0;$i<count($matches[0]);$i++){
~ $search[]=$matches[0][$i];
~ $str='';
~ for($j=0;$j<strlen($matches[0][$i]);++$j){
~ $str.='&#'.ord($matches[0][$i]{$j}).';';
~ }
~ $replace[]='<a href="mailto:'.$str.'">'.$str.'</a>';
~ }
~ }
~ }
~ return str_replace($search,$replace,$x);
}

I just pass the entire content block into it... It translates
"spam@koivi.com" to
"spam@koivi.com"
~ (as a link)

- --
Justin Koivisto - spam@koivi.com
http://www.koivi.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFBye7cm2SxQ7JEbpoRAuWvAJ95DCYlvEPljXB2bhd4x6 gw7lhmugCfeO9S
4EvWnu+iaayt8c5EhEYWJF8=
=54NE
-----END PGP SIGNATURE-----
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-22-2004, 19:00   #4 (permalink)
Toby Inkster
Civilians

 
Default Re: Hiding email address from spambots

Kerberos wrote:

> http://www.phoenity.com/newtedge/hide_email_spambots/


That's quite dumbassed.

1. Relies on CSS that's only supported in Gecko and Presto. Won't work in,
say, IE or in user agents that don't have CSS support.
2. Breaks seperation of content (HTML) and presentation (CSS).

My technique:
http://examples.tobyinkster.co.uk/email-hide

Uses Javascript, but doesn't *completely* break in non-Javascript user
agents.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-23-2004, 01:00   #5 (permalink)
C A Upsdell
Civilians

 
Default Re: Hiding email address from spambots

"Justin Koivisto" <justin@koivi.com> wrote in message
news:e7myd.712$CB.22799@news7.onvoy.net...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Kerberos wrote:
> | Neat article on how to hide e-mail addresses from spambots:
> | http://www.phoenity.com/newtedge/hide_email_spambots/
> | To date I have always used a Javascript, but it doesn't work with
> | XHTML, however this CSS hack works fine with XHTML, and will protect
> | e-mail addresses from being collected.
> |
>
> I've had good luck so far with this:
>
> /**
> * emailEncode
> *
> * Spits out email addresses using HTML entities instead of the actual
> * characters as an attempt to prevent spam to these addresses.
> * Searches for email addresses, links them, and encodes them.
> *
> * @param $x The content that contains the email address(es)
> * @result Returns the input with addresses encoded
> */
> function emailEncode($x){
> ~ $pattern='/([a-z][a-z0-9_.-\/\%]*@[^\s\"\)\?<>]+\.[a-z]{2,6})/i';
> ~ $search=array();
> ~ $replace=array();
> ~ if(preg_match_all($pattern,$x,$matches)){
> ~ if(isset($matches[0])){
> ~ // There should be at least one match from the string.
> ~ for($i=0;$i<count($matches[0]);$i++){
> ~ $search[]=$matches[0][$i];
> ~ $str='';
> ~ for($j=0;$j<strlen($matches[0][$i]);++$j){
> ~ $str.='&#'.ord($matches[0][$i]{$j}).';';
> ~ }
> ~ $replace[]='<a href="mailto:'.$str.'">'.$str.'</a>';
> ~ }
> ~ }
> ~ }
> ~ return str_replace($search,$replace,$x);
> }
>
> I just pass the entire content block into it... It translates
> "spam@koivi.com" to
> "spam@koivi.com"
> ~ (as a link)


Why generate the link on the fly? Just make a local page that converts an
email address to the string you desire, from which you can copy and paste it
into the code for your page. That way there is no need for JavaScript to be
enabled on the user's PC.




 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-23-2004, 01:00   #6 (permalink)
C A Upsdell
Civilians

 
Default Re: Hiding email address from spambots

"Justin Koivisto" <justin@koivi.com> wrote in message
news:e7myd.712$CB.22799@news7.onvoy.net...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Kerberos wrote:
> | Neat article on how to hide e-mail addresses from spambots:
> | http://www.phoenity.com/newtedge/hide_email_spambots/
> | To date I have always used a Javascript, but it doesn't work with
> | XHTML, however this CSS hack works fine with XHTML, and will protect
> | e-mail addresses from being collected.
> |
>
> I've had good luck so far with this:
>
> /**
> * emailEncode
> *
> * Spits out email addresses using HTML entities instead of the actual
> * characters as an attempt to prevent spam to these addresses.
> * Searches for email addresses, links them, and encodes them.
> *
> * @param $x The content that contains the email address(es)
> * @result Returns the input with addresses encoded
> */
> function emailEncode($x){
> ~ $pattern='/([a-z][a-z0-9_.-\/\%]*@[^\s\"\)\?<>]+\.[a-z]{2,6})/i';
> ~ $search=array();
> ~ $replace=array();
> ~ if(preg_match_all($pattern,$x,$matches)){
> ~ if(isset($matches[0])){
> ~ // There should be at least one match from the string.
> ~ for($i=0;$i<count($matches[0]);$i++){
> ~ $search[]=$matches[0][$i];
> ~ $str='';
> ~ for($j=0;$j<strlen($matches[0][$i]);++$j){
> ~ $str.='&#'.ord($matches[0][$i]{$j}).';';
> ~ }
> ~ $replace[]='<a href="mailto:'.$str.'">'.$str.'</a>';
> ~ }
> ~ }
> ~ }
> ~ return str_replace($search,$replace,$x);
> }
>
> I just pass the entire content block into it... It translates
> "spam@koivi.com" to
> "spam@koivi.com"
> ~ (as a link)


Why generate the link on the fly? Just make a local page that converts an
email address to the string you desire, from which you can copy and paste it
into the code for your page. That way there is no need for JavaScript to be
enabled on the user's PC.



 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-23-2004, 04:00   #7 (permalink)
Toby Inkster
Civilians

 
Default Re: Hiding email address from spambots

C A Upsdell wrote:

> That way there is no need for JavaScript to be enabled on the user's PC.


The post to which you responded doesn't use and Javascript.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[MV] Email address change Dan MV List 0 02-21-2005 02:50
contact Form want to force an email address Web Design 0 01-30-2005 16:00
Email address embedded in PowerPoint presentation =?Utf-8?B?c2d3YmFrZXI=?= Microsoft Applications 2 11-16-2004 12:00
iPaq 4150 - Email Return Address Gilbert Microsoft Applications 1 07-23-2004 16:43
Spammer publishing raw email address to their website Sharon Web Design 4 06-15-2004 11:03


Community Information
Options
Quick Options
Trackpads Non-Commercial Ad
Copyright Information Click to Visit
Time
Server Time
All times are GMT -4. The time now is 10:02.
Copyright
Copyright Information
The header is based off of work by Vipixel.com and modified by this site. Trackpads and the Trackpads Logo are both Registered Trademarks of Jason Edwards and cannot be used without prior written permission.  The only exception is as a link back to this site. Trackpads is a private website run by a small legion of volunteers, 3 dogs, 12.5 cats and an army of small, super smart, bio-engineered mice with pointy hats and tutu's. Search Engine Friendly URLs by vBSEO 3.2.0 RC7
Archive Links
Archive Links
Page generated in 1.13845 seconds with 19 queries