note 40919 added to function.htmlentities
| From: | arjini at mac dot com | Date: | Fri, 19 Mar 2004 04:49:28 +0000 |
| Subject: | note 40919 added to function.htmlentities | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67044@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:
###
$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.
----
Manual Page -- http://www.php.net/manual/en/function.htmlentities.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40919
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40919&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40919&report=yes
Search -- http://master.php.net/manage/user-notes.php