UBB.Dev
Posted By: Basil Fawlty Hide email from spambots - 12/27/2006 6:10 AM
Ok, I don't remember where or when I got this hack from my thread 6.5, but I placed this code in a certain location in both my showflat.php and showthreaded.php scripts in Threads 6.5 and what it does is causes anyone NOT LOGGED IN (read guests and bots) to NOT be able to read any emails in posts. Instead, the guest or bot will see [Login to view email] unless and until they log in.

So the question is, can one of you really smart guys figure out how I might adopt this little hack to work with Threads 7? I think hiding email addresses that members might post (not knowing any better) from bots would be a tremendous service to members. I am very worried that when I go live with T7, that many of my members who might have their email addresses posted in some thread somewhere are going to start getting SPAM. This little hack, if it could be adapted to work in T7 would be a realy valuable anti-spambot tool.

PHP Code
if(!$user['U_Username'] || $user['U_Username']==""){
$Body = preg_replace("/<a href=("|")mailto:(.*?)("|")>(.*?)<\/a>/i","<B>[Login to view email]</B>",$Body);
}



Basil
© UBB.Developers