php forum
php mysql forum
php mysql smarty
 
Topic Options
#313342 - 03/03/07 08:46 AM Hide Email from Spambots
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 135
Loc: New Mexico
First, I hope I am allowed to post a MOD here. Since I have a New Topic Button available I assumed it was ok. If not, feel free to delete. Anyway, as you know, when someone posts an email in a post, if it's a forum that guests can read, then you know that SPAM bots can also read it, right? Well, years ago I had a Mod in my old Threads 6.X that someone else wrote which would hide any email addresses in posts unless you were logged in. If you were not logged in, all you would see was [login to view email] (or whatever message you want). So I can't take full credit for this MOD because I only modified it to work with 7.1 - and it works great! (It may work with other versions as well).

Ok, first, as you know, there are two ways a member can post an email in a post and they both require different methods to "hide" from the spam bots. The first method is when a member just types in the email directly in the post (does not use the "Mail" icon). In this case, we want to replace the "@" with a picture of an "@", So, simply make a small .gif of an "@" and put it in your appropriate images directory on your server. Then, in the Features Settings in the Control Panel, go to the Active Text tab and put this (I'm using PhP tags, but I know this isn't PhP):
Php Code:
 @|<img src="http://www.yourwebsite.com/yourforumdir/images/general/default/atsign.gif">
  


(Replace yourwebsite with your domain name and yourforumdir with the name of the directiry for your Threads install)

This way, if someone types in an email address directly in a post, the members can still "see" the email address, but the "@" is replaced with an image so the email address is not clickable, but also SPAM bots don't see it as an email address.

Ok, the second way a member can put an email address in a post is to use the "Mail" icon in the edit buttons. This works a little different and requires some code added to your showflat.inc.php file in the /scripts dir. (This assumes that your default style is "showflat" and not "Threaded" because the spam bots will see threads in flat mode if that is the default. I suspect a similer mod can be made to showthreaded.inc.php if necessary.

In showflat.inc.php, find this piece of code:

Php Code:

// ---------------------------
		// Do they get an edit button?
		
		$edit_now = time();
		$edit_window = $config['MAX_EDIT_TIME'] * 60;
  


Then, just above that , add this code:

Php Code:

// DO WE HIDE MAIL FROM NON-LOGGED IN?
if(!$user['USER_DISPLAY_NAME'] || $user['USER_DISPLAY_NAME']==""){
$Body = preg_replace("/<a href=(\"|&quot;)mailto:(.*?)(\"|&quot;)>(.*?)<\/a>/i","<B>[Login to view email]</B>",$Body);
}
  


You can change the [Login to view email] to whatever you want it to say. This is what a guest (or spam bot) will see if someone has used the mail button to post a "mailto:" email address in a post. Anyone who is logged in of course, will see the actual email address (and it will be clickable).

Hope this is useful. I feel that protecting email addresses in posts from spam bots a a good service to provide to our members.

Basil
_________________________

Top
#313343 - 03/03/07 09:56 AM Re: Hide Email from Spambots [Re: Basil Fawlty]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
Thanks for sharing, shoud be standard in ubb.threads smile
_________________________
- Allen wavey
- What Drives You?

Top
#313345 - 03/03/07 10:05 AM Re: Hide Email from Spambots [Re: AllenAyres]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 135
Loc: New Mexico
Originally Posted By: AllenAyres
Thanks for sharing, shoud be standard in ubb.threads smile


My pleasure. I agree it should be standard and I've made that request over on UBBCentral. The way I'd like to see it work is, whether a person uses the mail button or just types in an email address directly, it should produce a "mailto:" link like the button does. However, it can only be viewed by members logged in. It would be cool to also have a field in the CP where you could designate what message you want guests (or bots) to see if they view an email address while not logged in.

Basil
_________________________

Top
#313360 - 03/04/07 03:06 AM Re: Hide Email from Spambots [Re: Basil Fawlty]
Ian_W Offline

Veteran

Registered: 02/22/02
Posts: 2575
Loc: England
Thanks Basil - always feel free to post any mods - you do not need to be anything special to do so smile

Thanks again smile
_________________________
Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)

Top



Moderator:  sirdude 
Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks