note 40919 deleted from function.ord by hholzgra

From: Date: Thu, 02 Aug 2012 11:38:16 +0000
Subject: note 40919 deleted from function.ord by hholzgra
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-189599@lists.php.net to get a copy of this message
Note Submitter: arjini at mac dot com ---- 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.

« previous php.notes (#189599) next »