Re: Little script that might help against some email-/webcrawlers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, November 20, 2006 6:54 am, Frank Arensmeier wrote:
> Since I published email adresses to colleges of mine on our contact
> pages some months ago, the amount of spam mail has increased
> dramatically recently. So, I thought of how to make life for email-/
> web-crawlers a little bit harder. Of course, there are plenty
> "solutions" out there. But most of them use JavaScript to some
> extend. And since I am very concerned about availability/usability, I
> came up with this script:
>
> <?php
>
> // this function will return the input string encoded in ASCII values
> // e.g. "test" will be outputted as "&#116;&#101;&#115;&#116;"
>
> function encode_email ( $str )
> {
>
> 	$out = "";
>
> 	if ( empty ( $str ) ) {
> 		return false;
> 	}
>
> 	$pieces = preg_split ( "//", $str );
>
> 	foreach ( $pieces as $key => $piece ) {
> 		if ( ord ( $piece ) ) {
> 			$out .= "&#" . ord ( $piece ) . ";";
> 		}
> 	}
> 	return $out;
> }
>
> ?>
>
> Call the function e.g. by:
> <a href="mailto:<?php echo encode_email ("me@xxxxxxxxxx" ); ?>">Mail
> me!<a/>

Last I heard, the spammers were still finding SO many emails, even the
simplest obfuscation would be passed over...

so just str_replace('@', '%40', $email) would probably be equally useful.

YMMV

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux