![]() | ![]() | ![]() |
| |||||||
| Forums | Register | Groups | Awards | Arcade | Pets | T-Bucks / T-Store | Invite Your Friends | Blogs | Mark Forums Read |
| Web Design Forums and discussions on webdesign |
Web Design | |||||||||
|
|
|
|
| |||||
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Civilians | 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 |
|
| | #2 (permalink) |
| Civilians | On Wed, 22 Dec 2004 11 35 -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 |
|
| | #3 (permalink) |
| Civilians | -----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----- |
|
| | #4 (permalink) |
| Civilians | 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 |
|
| | #5 (permalink) |
| Civilians | "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. |
|
| | #6 (permalink) |
| Civilians | "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. |
|
| | #7 (permalink) |
| Civilians | 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 |
|
![]() |
| Bookmarks |
| Thread Tools | |
| |
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 |
![]() | ![]() | ![]() |