note 40919 modified in function.ord by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 17:08:28 +0000 |
| Subject: | note 40919 modified in function.ord by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154945@lists.php.net to get a copy of this message | ||
If you're looking to provide bare bones protection to email addresses posted to the web try
this:
<?php
$string = 'arjini@mac.com';
for($i=0;$i<strlen($string);++$i){
$n = rand(0,1);
if($n)
$finished.='&#x'.sprintf("%X",ord($string{$i})).';';
else
$finished.='&#'.ord($string{$i}).';';
}
echo $finished;
?>
This randomly encodes a mix of hex and oridinary HTML entities for every character in the address.
Note that a decoding mechanism for this could probably be written just as easily, so eventually the
bots will be able to cut through this like butter, but for now, it seems like most harvesters are
only looking for non-hex html entities.
--was--
If you're looking to provide bare bones protection to email addresses posted to the web try
this:
###
$string = 'arjini@mac.com';
for($i=0;$i<strlen($string);++$i){
$n = rand(0,1);
if($n)
$finished.='&#x'.sprintf("%X",ord($string{$i})).';';
else
$finished.='&#'.ord($string{$i}).';';
}
echo $finished;
###
This randomly encodes a mix of hex and oridinary HTML entities for every character in the address.
Note that a decoding mechanism for this could probably be written just as easily, so eventually the
bots will be able to cut through this like butter, but for now, it seems like most harvesters are
only looking for non-hex html entities.
http://php.net/manual/en/function.ord.php