UBB.Dev
Posted By: Basil Fawlty Email mod to block spam-bots - 11/23/2004 4:32 PM
I apologize if this idea has alread been discussed. I did do a search, but could not find it. This is an idea that I would really like to see implemented (and I'd be willing to help, though I'm not an expect at the finer points of PhP)

IDEA: Implement a mod so that no public email addresses can be viewed unless a member is logged in. The idea is to prevent spam-bots from harvesting email addresses from your forum.

DETAILS: I would like to see a mod that is selectable in the control panel that would do the following: If selected, no email address would be viewable unless a member was logged in. At present, Threads has a setting in the control panel that will limit viewing the user list unless a person is a member is logged in. That's fine, but why not take it to the next step. With this mod, if a check box is selected, then no email addresses on the forum would be viewable to anyone (including bots) unless a member is logged in.
For example, right now, anyone can click a members name in a message and view their profile, including their email address if they have one. With this mod, they could still view the profile, but in place of the email address would see something like this: [email hidden unless logged in]

The same would apply to any post that a member views in which a person has included an email address using the [ email ] UBB tags.

I think this type of mod would be a big help in preventing spammers from grabbing forum members' email addresses. Would like to know what you guys think? Is this doable (or has it been done and I just can't find it?)

Basil
Posted By: Anno Re: Email mod to block spam-bots - 11/23/2004 5:36 PM
Very fast fix:
in showprofile.php

Search for:

// ------------------------------------------------
// If this is a coppa user, we can't show some info


add before:

if(!$Username && $Fakeemail){
$Fakeemail="[hidden for Guests]";
}
Posted By: Anno Re: Email mod to block spam-bots - 11/23/2004 5:54 PM
>The same would apply to any post that a member views in which a person has
>included an email address using the [ email ] UBB tags.

This is also easy.
In showflat.php and showthreaded.php
Search for:
// ------------------------------------------------------------------
// If we came from the search engine then we bold the search keywords

Insert before:
Code
 if(!$Username || $Username == ""){<br />       $Body = preg_replace("/<a href=(\"|&quot;)mailto:(.*?)(\"|&quot;)>(.*?)<\/a>/i","[email not visible for Guests]",$Body);<br /><br />} 
Posted By: dimopoulos Re: Email mod to block spam-bots - 11/24/2004 12:09 AM
You can also make a small modification on the showprofile.php to scramble the emails of users that are registered so that the email spiders are being fed with junk (a good way to pay them back). This alteration assumes that you have the IIP installed.

require_once("./pals/spiderfood.php");

if ($thisuser['U_Number'] < 2) {
$Fakeemail = screwy_Mail($Fakeemail);
$ICQ = screwy_Mail($ICQ);
$Extra2 = screwy_Mail($Extra2);
$Extra3 = screwy_Mail($Extra3);
$Extra4 = screwy_Mail($Extra4);
$Extra5 = screwy_Mail($Extra5);
}
Posted By: dimopoulos Re: Email mod to block spam-bots - 11/24/2004 12:10 AM
and to add: the include should be at the top of the script while the next part should be after this block of code:

// ------------------------------------------------
// If this is a coppa user, we can't show some info
if ($coppauser) {
$Fakeemail = "";
$Name = "";
$Homepage = "";
$Occupation = "";
$Hobbies = "";
$Location = "";
$Bio = "";
$ICQ = "";
$Extra2 = "";
$Extra3 = "";
$Extra4 = "";
$Extra5 = "";
$Picture = "";
}
Posted By: Basil Fawlty Re: Email mod to block spam-bots - 11/24/2004 5:03 PM
[]Anno said:
>The same would apply to any post that a member views in which a person has
>included an email address using the [ email ] UBB tags.

This is also easy.
In showflat.php and showthreaded.php
Search for:
// ------------------------------------------------------------------
// If we came from the search engine then we bold the search keywords

Insert before:
Code
 if(!$Username || $Username == ""){<br />       $Body = preg_replace("/<a href=(\"|&quot;)mailto:(.*?)(\"|&quot;)>(.*?)<\/a>/i","[email not visible for Guests]",$Body);<br /><br />} 
[/]

Thanks very much!! Your suggestion for the showprofile.php works great! However, I included your suggested code before the location you state in the showflat and showthreaded files and it has no effect.. When I am not logged in, I can still view the email addresses members have placed in posts. Is there perhaphs a typo in the code? (I'm not getting any errors, but its not doing anything either).

Thanks,
Basil
Posted By: Anno Re: Email mod to block spam-bots - 11/24/2004 7:04 PM
Ah, yes....

One has to use $user['U_Username'] instead of $Username...

if(!$user['U_Username']){
$Body = preg_replace("/<a href=("|")mailto:(.*?)("|")>(.*?)<\/a>/i","[email not visible for Guests]",$Body);
}
Posted By: Basil Fawlty Re: Email mod to block spam-bots - 11/26/2004 2:50 AM
[]Anno said:
Ah, yes....

One has to use $user['U_Username'] instead of $Username...

if(!$user['U_Username']){
$Body = preg_replace("/<a href=("|")mailto:(.*?)("|")>(.*?)<\/a>/i","[email not visible for Guests]",$Body);
} [/]

Indeed! That did the trick, but I added also:

if(!$user['U_Username'] || $user['U_Username']==""}

Thanks!

Basil
© UBB.Developers