Forum Moderators: coopster
What I'm after is a php script to try and remove as well as possible the attempts people make to include email addresses, phone numbers and other forms of contacting them.
Now I know this is a tricky thing to do, but we need to do the best we can in code to minimise manual checking.
So things like 'me at mysite dot com' need to be found and removed. Plus various forms of international telephone numbers and any other forms of contact.
Anyone got any ideas?
You could start by searching here for "validating forms" it will give an idea on the construction
Do you have any experience in regular expression?
a possibility will be to only allow for punctuation, and alphanumerical characters
check
HERE [webmasterworld.com]
Even if you had a really good set of regular expressions that could filter out email addresses, I question it's ability to solve your problem. After all, people are on community sites because they want to connect to other people.
People will end up embedding contact information in pictures, posting "search engine hints" for how to find a page that has their contact details, or writing email address haikus. Folks will write a whole paragraph of text with numbers interspersed then say "put the numbers together and call me." The harder you crack down, the more creative people will get.
Dating sites have to deal with this because they decided their revenue stream would be from people paying for the opportunity to contact another member outside of the site. Their solution to allow limited contact until a member ponies up membership? They simplify contact to "winks" or "icebreakers" where a person chooses from a dozen different stock messages.
Perhaps something like that could have benefit? With a little more information I could probably come up with a better idea. :)
Best of luck!
cut down the number of fields and make the ones that are there even shorter
require email address on signup but then don't show it in the profiles
take a look at our profiles here and how small they are, they aren't abused very often, though they still are, as are all things on a forum.
from there at least you minimize the amount of trouble ;)
as everyone mentioned it is too hard to automate even to a relative degree. I feel your pain, I do a fair amount of editing myself.
I know people will get creative, I know I have on similar sites, but we just need to do as much as we can in the code. We accept that there is a certain amount of manual checking required.
I haven't got to grips with regular expressions yet, but I know what they are and what they do :) I do a lot of php, asp etc etc though.
I appreciate the possible other uses of a script to do this, but I can assure you my reasons for this script are legit :)
so simple checks for the pattern 'word at word dot com' and other domain types 'dot co dot uk' etc etc
checks for numbers and number words together to trap phone numbers
is that type of thing posible and reliable?
Any how:
$pattern = array(
"/(\w(\.?))+(@¦\s+at\s+)[a-zA-Z_]+?((\.¦\s+dot\s+)[a-zA-Z]{2,4})+/",
"/(\()?(\d{3})?(\))?\s?(\d{3}(-¦\.¦_¦\s)?)+\d{4}/"
);
$text = "
example at domain.com<br>
example.example@domain.co.uk<br>
example at domain dot net<br>
example at domain dot co dot uk<br>
meet at mcdonalds.we will lose the previos words unfortunately<br>
123.4567<br>
123.456.7890<br>
1234567890<br>
123-456-7890<br>
(123)456-7890<br>
(123) 456 7890
";
$replace = 'SNIP';
$text = preg_replace($pattern, $replace, $text);
print $text;
Don't be rediculous..
The key word here is 'community', you are building a community and to do that by offering deliberate restrictions on contact is just totally counterproductive..
On the contrary contact between members should be encouraged.. using your mindset, it is like inviting people to a party then locking them in the house, I can assure you they would soon leave and never come back..
If you want to build a community and retain it then get creative instead of looking for some code that is going to cut peoples legs off..
[edited by: Lobo at 2:12 pm (utc) on Oct. 18, 2006]
I'm just the developer working on the site,
That's your job..
I know where you are coming from though, but they do not want to make fundamental changes to the way the site already works at this stage.
It would, perhaps, be better for any edit that gets flagged by the algo to simply be "put on hold pending review." Then five or so minutes later, automatically roll back the profile to the previous version and fire off an automated email to the member reminding them about the site's contact policy. They could still reduce the edit to only the email string and work on a way to circumvent the filter, but implying that a human is coming to check each time they trigger it should reduce the number of people who try.
Behavioral approaches are a handy addition to algorithmic filters. ;)