wkilc Posted August 9, 2011 Share Posted August 9, 2011 Hi all, I use a script that for a member directory that grabs, amongst other things, member e-mail addresses, and then displays them as part of the member directory. while ($row = mysql_fetch_object($result)) { $snre_eMail=$row->eMail; echo "<td><a href='mailto:$eMail'>$eMail</a></td>"; I know how to use JavaScript and/or unicode to hide e-mail for a "static" (hard-coded) address... but can anyone help me apply that to all these addresses pulled from the MySQL db? For instance, can we tell it to translate the "@" to its unicode equivalent "@" before echoing the address, just for some basic protection? Thanks. Link to comment https://forums.phpfreaks.com/topic/244348-protect-e-mail-addresses-from-bots/ Share on other sites More sharing options...
Psycho Posted August 9, 2011 Share Posted August 9, 2011 Take a look at this thread: http://www.phpfreaks.com/forums/index.php?topic=339003.msg1598048#msg1598048 Link to comment https://forums.phpfreaks.com/topic/244348-protect-e-mail-addresses-from-bots/#findComment-1254996 Share on other sites More sharing options...
wkilc Posted August 9, 2011 Author Share Posted August 9, 2011 Thank you. I'm seeing a lot of ways to manually protect individual addresses... but I'm looking for a way to replace some characters dynamically as they're pulled from the db. I thought I was on to something here, but I'm getting a syntax error. while ($row = mysql_fetch_object($result)) { $eMail=$row->eMail; $NEWeMail = str_replace("@", "@", $eMail); echo "<td><a href='mailto:$NEWeMail'>$NEWeMail</a></td>"; Link to comment https://forums.phpfreaks.com/topic/244348-protect-e-mail-addresses-from-bots/#findComment-1255015 Share on other sites More sharing options...
Jumpy09 Posted August 9, 2011 Share Posted August 9, 2011 I thought that using the code was just another way to display the same thing, even if you use the code "@" isn't it still visually and identically the same thing as @? If you copy the code, it still copies as @. Most places use email at site dot com, and do relatively fine. What syntax error are you getting? Link to comment https://forums.phpfreaks.com/topic/244348-protect-e-mail-addresses-from-bots/#findComment-1255026 Share on other sites More sharing options...
wkilc Posted August 9, 2011 Author Share Posted August 9, 2011 Thanks again. This is what I've come up with: while ($row = mysql_fetch_object($result)) { $eMail=$row->eMail; $unsafe = array("@", ".com", ".edu", ".net"); $safer = array("@", ".com", ".edu"); $NEWeMail = str_replace($unsafe, $safer, $eMail); echo "<td><a href='mailto:$NEWeMail'>$name</a></td>"; I'm going to display the name rather than the e-mail address, then use the unicode to relpace the "@" and the ".com", ".net", etc... in the domain name in the link source code. Then again, I may just protect the entire page as well... Link to comment https://forums.phpfreaks.com/topic/244348-protect-e-mail-addresses-from-bots/#findComment-1255034 Share on other sites More sharing options...
Jumpy09 Posted August 9, 2011 Share Posted August 9, 2011 You may want to read up on http://www.unicom.com/blog/entry/173 because it states that HTML Entities for obscuring your email address doesn't work. However if you HTML Entity the Mailto link itself, it may fool a few bots. Technically it is your call, but I wouldn't see why it would work. Edit: This was documented back in 2003, and there has been just about 8 years of advancement for bots. Once again it is your call. Link to comment https://forums.phpfreaks.com/topic/244348-protect-e-mail-addresses-from-bots/#findComment-1255040 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.