views:

41

answers:

2

I have implemented a php/codeigniter messaging system and want to prevent users from posting their phone numbers, addresses, e-mails, websites or anything else that might allow for user contact outside of our messaging system.

Does anyone know of any available plugins or code that would remove such personal information from text?

Thanks

A: 

Take a look at this (the accepted answer):

http://stackoverflow.com/questions/1113840/php-remove-url-from-string

This removes a URL from a string. You can modify this to also remove email, phone number, etc...

Todd Moses
+2  A: 

It is really difficult task and you can't be 100% sure that you'll prevent submitting such information.

You can easily prevent from posting emails and urls (in ISO standart form, of course), but it will be real pain in the ass for phone numbers and addresses.

[email protected] can be represented as email at email.com or email[at]email.com etc.

http://www.google.com can be represented as google dot com etc.

Validating addresses seems me to be unresolvable task at all Green st. 1-1 = st. Green house #1, flat#1; It's almost impossible to validate such strings.

Phone could be faked as well (1 121 123 43 23 => 1 one-two-one ...).

I advice you to simplify your task. It is real wasting of time, imho.

PS: If you'll decide to solve this task, then regular expressions will help you a lot and it will be invaluable experience that will make your developer skill higher!

Kirzilla
I would think that after so many years of php being available and forums, that somebody would've come up with some kind of decent filtering system. If no one knows, then I can delete most major email provider names from the text which would deter many from listing their e-mail. Or even just flag the user that we think we've detected a phone number or an e-mail. Oh and we need it because we're losing transactions by people discussing outside of our marketplace. Anyone else have a moderate solution?
programmerdave