AdRock Posted December 15, 2007 Share Posted December 15, 2007 I am trying to find an easier way to change email addresses into ascii to prevent email harvesters grabbing email address but i'm having problems getting it to work properly. Here is the code <?php $email = "[email protected]"; $letters = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "@", ".", "-", "_"); $ascii = array("&98;", "&99;", "&100;", "&101;", "&102;", "&103;", "&104;", "&105;", "&106;", "&107;", "&108;", "&109;", "&110;", "&111;", "&112;", "&113;", "&114;", "&115;", "&116;", "&117;", "&118;", "&119;", "&120;", "&121;", "&122;", "&48;", "&49;", "&50;", "&51;", "&52;", "&53;", "&54;", "&55;", "&56;", "&57;", "&64;", "&46;", "&45;", "&95;"); $output = str_replace($letters, $ascii, $email); echo $output; ?> and this is the output (nothing like it shouldlook) &&&54;0;&&54;0;&56;;&&&54;0;&&&54;3;&64;;&&54;1;;&&&54;0;&&54;0;&55;;&&&54;0;&&54;0;&56;;&46;&&&54;0;&&&54;3;&64;;&&54;0;;&&&54;0;&&54;0;&&54;1;;&&&54;0;&&54;0;&&&54;3;&64;;;&&64;&57;;&&&54;0;&&&54;3;&64;;&55;;&&&54;0;&&54;0;&&54;0;;&45;&&&54;0;&&&54;3;&64;;&&&54;3;&64;;;&&&54;0;&&54;0;&&54;1;;&&&54;0;&&54;0;&&&54;3;&64;;; I can see several @ signs in the output generated and what is with &&& ? Link to comment https://forums.phpfreaks.com/topic/81801-solved-using-str_replace-to-replace-email-address-to-ascii/ Share on other sites More sharing options...
AdRock Posted December 15, 2007 Author Share Posted December 15, 2007 I have narrowed it down to the ascii conversion of numbers causing the problems but still don't know why it's doing it Link to comment https://forums.phpfreaks.com/topic/81801-solved-using-str_replace-to-replace-email-address-to-ascii/#findComment-415596 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.