vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Automatic email adress re-formatting to prevent harvesting (https://vborg.vbsupport.ru/showthread.php?t=148399)

tobias_t 05-29-2007 03:11 PM

Automatic email adress re-formatting to prevent harvesting
 
Hi everybody,

I am looking for a solution to have vBulletin automatically break up email addresses in postings to prevent address harvesting. So that if a user enters myname@domain.com, it would be "corrected" into myname @ domain.com or myname AT domain.com

I guess there is a solution for this already in place so please point me towards it :-)

Best, Tobias

Make Money? 05-29-2007 05:04 PM

Good One!

tobias_t 05-30-2007 11:34 AM

I was expecting this to be easy, but maybe it's not. Should I post this under mod suggestions instead?

Dismounted 05-31-2007 07:55 AM

I've just thought it through and it's not that hard, use some preg functions to sort them out.

tobias_t 05-31-2007 10:00 AM

Quote:

Originally Posted by Dismounted (Post 1258212)
I've just thought it through and it's not that hard, use some preg functions to sort them out.

Thanks! I am not exactly an ace with preg functions though, so any suggestions on how to implement this would be appreciated :)

Dismounted 05-31-2007 11:25 AM

Match a part of a string with @ followed by a . and make sure that they are alphanumeric.

tobias_t 06-06-2007 10:53 AM

OK, we are getting closer. I have no clue whatsoever about preg functions and would need a step-by-step type of explanation where and how to implement this. Any further help is appreciated :)

Thanks, Tobias

Dismounted 06-07-2007 06:39 AM

Read up on regular expression.

Dave Hawley 06-07-2007 07:48 AM

I think spammers are fully aware of this and work-around it. There should never be a need to post emails in posts anyway.

Dismounted 06-07-2007 11:42 AM

It's not to prevent spammers. It's to prevent email-harvesting bots.

Dave Hawley 06-07-2007 12:32 PM

Ok, replace "spammers" with email-harvesting bots.

Dismounted 06-08-2007 10:11 AM

Okay then, despite what you think, it still prevents most of them.

Dave Hawley 06-08-2007 10:21 AM

I would say some not "most". vBullentin already has a contact form that spam bots cannot harvest user emails from. Condoning users posting their emails in posts (even in the manner described) is not responsible IMO.

Think about it, if were running a spam bot, wouldn't you work/design around such obvious tactics?

tobias_t 06-08-2007 10:35 AM

Quote:

Originally Posted by Dismounted (Post 1263019)
Read up on regular expression.

I guess I am not the only one around here who is not a programmer, and I actually posted here because I hoped someone would have the courtesy to post a complete explanation of how to set this up.

Dismounted 06-08-2007 10:41 AM

I'm only telling you to read up on regex because it wouldn't expand any of your knowledge if I did everything for you.

tobias_t 06-08-2007 11:13 AM

Quote:

Originally Posted by Dismounted (Post 1264032)
I'm only telling you to read up on regex because it wouldn't expand any of your knowledge if I did everything for you.

Actually, I have some limited knowledge about regex, but I have no idea where or how to enter the corresponding formula in vBulletin to make it change the posting text automatically.

Dismounted 06-08-2007 12:44 PM

You would need to add a plugin hooking at postbit_display_complete. The message's variable is $post['message'].

tobias_t 06-08-2007 12:48 PM

Seriously, if I would know how to add a plugin hooking to a template, I would very likely not have posted this question here in the first place ;)

Dismounted 06-09-2007 03:57 AM

Sometimes you just need to look......Admin CP > Plugins & Products > Add New Plugin.

Dave Hawley 06-09-2007 05:47 AM

Dismounted, if you know how to do this why not simply tell tobias_t rather than playing cryptic messages? Or perhaps you yourself don't know?

Dismounted 06-09-2007 11:05 AM

I have told him what he needs. You say I don't know how? Let me prove you wrong.
1/ Admin CP > Plugins & Products > Add New Plugin
2/ Hook Location: postbit_display_complete
3/ PHP Code:
PHP Code:

$post['message'] = preg_replace('/(<a href="mailto:)(.*)@(.*)(["]{1})/i'"$2 AT $3"$post['message']; 


Dave Hawley 06-10-2007 12:40 AM

No, I asked if you know how. That's what this (?) funny little character means :)

There ya go tobias_t, you just need to know how to ask :)

HMBeaty 06-10-2007 12:59 AM

Hahaha, that's awesome. Just gotta ask the right question I suppose ;)

Dismounted 06-10-2007 02:44 AM

Quote:

Originally Posted by Dave Hawley (Post 1265139)
No, I asked if you know how. That's what this (?) funny little character means :)

There ya go tobias_t, you just need to know how to ask :)

To me, you sounded like you were accusing me of not knowing how to code. I could've just told you to look at my profile to see all the URL rewriting hacks I've done....

Dave Hawley 06-10-2007 03:02 AM

No, not all. I have no idea what you are capable of. However, you do seem to assume those asking questions have the same capabilities as you. Which would beg the question of why they would ask in the 1st place ;)

tobias_t 06-11-2007 07:52 AM

Quote:

Originally Posted by Dismounted (Post 1264717)
I have told him what he needs. You say I don't know how? Let me prove you wrong.
1/ Admin CP > Plugins & Products > Add New Plugin
2/ Hook Location: postbit_display_complete
3/ PHP Code:
PHP Code:

$post['message'] = preg_replace('/(<a href="mailto:)(.*)@(.*)(["]{1})/i'"$2 AT $3"$post['message']; 


Thanks! Doesn't look like something I could ever have come up with myself, so your help is much appreciated :D

I don't yet get it to work though -

On our test server, installing this hack gives me this message on showthread:

Parse error: syntax error, unexpected ';' in /srv/www/htdocs/forum/includes/class_postbit.php(296) : eval()'d code on line 1

On our live server, it does no changes to email addresses at all.

Both installations are 3.6.6. Any ideas?

Dismounted 06-11-2007 11:06 AM

PHP Code:

$post['message'] = preg_replace('/(<a href="mailto:)(.*)@(.*)(["]{1})/i'"$2 AT $3"$post['message']); 


tobias_t 06-11-2007 12:08 PM

Quote:

Originally Posted by Dismounted (Post 1266159)
PHP Code:

$post['message'] = preg_replace('/(<a href="mailto:)(.*)@(.*)(["]{1})/i'"$2 AT $3"$post['message']); 


This works much better, but it doesn't yet work work 100%. For name@domain.com, it gives the output:

name AT domain.com>name@domain.com

kennethsia 06-11-2007 12:40 PM

:p cool a mod in the making ^^ go dismounted!

Dismounted 06-12-2007 09:43 AM

PHP Code:

$post['message'] = preg_replace('/(<a href="mailto:)(.*)@(.*)(">(.*)</a>)/i'"$2 AT $3"$post['message']); 

To you coders, you are not allowed to use this code in your own hacks because I'm making one out of this :p.

tobias_t 06-12-2007 09:50 AM

Quote:

Originally Posted by Dismounted (Post 1266831)
PHP Code:

$post['message'] = preg_replace('/(<a href="mailto:)(.*)@(.*)(">(.*)</a>)/i'"$2 AT $3"$post['message']); 


This simply seems to eat the email address whole, it doesn't output any string in both of our forum installations.

On our test server, it additionally gives the message:

preg_replace() [function.preg-replace]: Unknown modifier 'a' in /includes/class_postbit.php(296) : eval()'d code (Zeile 1)

Very exciting to be part of a mod development :D

Dismounted 06-12-2007 09:53 AM

PHP Code:

$post['message'] = preg_replace('/(<a href="mailto:)(.*)@(.*)(">(.*)<\/a>)/i'"$2 AT $3"$post['message']); 

Sorry, forgot to comment the slash.

tobias_t 06-12-2007 10:01 AM

Quote:

Originally Posted by Dismounted (Post 1266839)
PHP Code:

$post['message'] = preg_replace('/(<a href="mailto:)(.*)@(.*)(">(.*)<\/a>)/i'"$2 AT $3"$post['message']); 

Sorry, forgot to comment the slash.

Working :up:

Thanks so much! :)


All times are GMT. The time now is 02:54 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01256 seconds
  • Memory Usage 1,797KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (33)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete