PHP Web Host - Quality Web Hosting For All PHP Applications $35/month $250/year (Unlimited) - $25/month - 200,000 impressions - Your Ad Could be Here - Click For Details
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
dad7732
RavenNuke(tm) Development Team


Joined: Mar 18, 2007
Posts: 1191

PostPosted: Mon Mar 08, 2010 5:10 pm Reply with quote Back to top

I run a major support site with RN 2.4 and for some reason users are intent on publishing their phone numbers in the forums hoping someone will call them to discuss issues and talk them through fixes. No matter how much I stress to NOT publish private data, etc. it still happens on a regular basis.

Is there some way in RN to mask a phone number being posted with the output something like xxx-xxx-xxxx when a number is entered, much the same as masking dirty words,etc. It's getting problematic to have to keep up with this on a "daily" basis sometimes.

Cheers
View user's profile Send private message
nuken
RavenNuke(tm) Development Team


Joined: Mar 11, 2007
Posts: 1536
Location: North Carolina

PostPosted: Mon Mar 08, 2010 5:20 pm Reply with quote Back to top

You could add 0-9 in the censor list in the config file, but no numbers will appear.
View user's profile Send private message Send e-mail Visit poster's website
dad7732
RavenNuke(tm) Development Team


Joined: Mar 18, 2007
Posts: 1191

PostPosted: Mon Mar 08, 2010 5:26 pm Reply with quote Back to top

Thought of that but "no numbers will appear" like you said and that's not good in a support forum ... Sad

Cheers
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Tue Mar 09, 2010 2:34 am Reply with quote Back to top

Wow, I have never heard of nor seen this issue before. Programatically it could be most easily done with regex's. But I have to ask you what the issue really is? Imo, if people are stupid enough to post their phone numbers then so be it. Otoh, you could post a simple warning that anyone who posts their phone number will have their post removed and/or will be suspended for a set amount of time. Just my opinion Wink
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
dad7732
RavenNuke(tm) Development Team


Joined: Mar 18, 2007
Posts: 1191

PostPosted: Tue Mar 09, 2010 7:31 am Reply with quote Back to top

Dealing with any support type forums you deal with a planet-wide cross section of users, some of which are desparate enough or computer-challenged enough to solicit a solution by any means, even if it means posting a phone number and/or email address so that a tech can walk them through the solution. Removing a post is not an option simply because it also removes the user's explanation of the issue at hand. Warnings as to the ramifications of posting private information go unheeded, you know as well as I do that users do NOT read posted instructions, not even the FAQS that contain solutions to problems. Removing (manually editing) any posted private information along with a note in the users post as to why it was removed usually transmits the "message". However, it gets quite tedious sometimes to have to continually do this - time is precious as you well know - hence the request for some means to censor out phone numbers. I have enough moderators that can be on the lookout and remove private info when/if necessary but an auto-number-censor would be quite useful. An auto-remove function would be nice simply because the search engines habitually grab posts more than once daily thereby making the private info available to the rest of the universe.


Cheers
View user's profile Send private message
wHiTeHaT
Involved
Involved


Joined: Jul 18, 2004
Posts: 442
Location: Netherlands

PostPosted: Tue Mar 09, 2010 11:20 am Reply with quote Back to top

i'm sorry but i dont understand the problem you have with , that others put theire phonenumber on your forum.
Is there a law i am not aware of that you could be responseble for anything related to this?
On the other hand , most phonenumbers are not private but public.
A good reference to check that is a phonebook!

I'm sorry that this isnt the solution you looking for, but it might be worth a thought.
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
dad7732
RavenNuke(tm) Development Team


Joined: Mar 18, 2007
Posts: 1191

PostPosted: Tue Mar 09, 2010 12:29 pm Reply with quote Back to top

Actually I have the duty as owner/admin to attempt to protect my users from posting potential harmful information that may compromise their privacy. Most of my users are registered with an alias, not their real name. With that in mind how do you propose to find the phone number for the user "Winnie The Pooh" for example in any "phonebook" on the planet if it's not posted in the forum? Very Happy

While not legally responsible for a user posting private information, I do feel it necessary to remove a phone number in order to protect the user, mostly from themselves.

Cheers
View user's profile Send private message
wHiTeHaT
Involved
Involved


Joined: Jul 18, 2004
Posts: 442
Location: Netherlands

PostPosted: Tue Mar 09, 2010 1:05 pm Reply with quote Back to top

here:
Only registered users can see links on this board!
Get registered or login to the forums!
is a free code to prevent spam from "unregistered users".

Inside it there's also a option to block phonenumbers ( sort of).
You could manipulate the code and use it in your forum.
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
dad7732
RavenNuke(tm) Development Team


Joined: Mar 18, 2007
Posts: 1191

PostPosted: Tue Mar 09, 2010 1:16 pm Reply with quote Back to top

Interesting concept but unusable here because anonymous unregistered users cannot post anyway.

Cheers
View user's profile Send private message
wHiTeHaT
Involved
Involved


Joined: Jul 18, 2004
Posts: 442
Location: Netherlands

PostPosted: Tue Mar 09, 2010 1:17 pm Reply with quote Back to top

wHiTeHaT wrote:
here:
Only registered users can see links on this board!
Get registered or login to the forums!
is a free code to prevent spam from "unregistered users".

Inside it there's also a option to block phonenumbers ( sort of).
You could manipulate the code and use it in your forum.
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
dad7732
RavenNuke(tm) Development Team


Joined: Mar 18, 2007
Posts: 1191

PostPosted: Tue Mar 09, 2010 1:25 pm Reply with quote Back to top

I looked at it and it appears to work only for unregistered "guests". I'll continue to have a look ..
View user's profile Send private message
wHiTeHaT
Involved
Involved


Joined: Jul 18, 2004
Posts: 442
Location: Netherlands

PostPosted: Tue Mar 09, 2010 1:26 pm Reply with quote Back to top

grab the code abouth the phonenumber block and use that as a leed to get the thing done as you want.

That was the reason i showed you this script.
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
dad7732
RavenNuke(tm) Development Team


Joined: Mar 18, 2007
Posts: 1191

PostPosted: Tue Mar 09, 2010 1:32 pm Reply with quote Back to top

Like I said, I'll continue to look at it.

Cheers
View user's profile Send private message
Susann
Moderator


Joined: Dec 19, 2004
Posts: 3143
Location: Germany:Moderator German NukeSentinel Support

PostPosted: Tue Mar 09, 2010 1:51 pm Reply with quote Back to top

I know this problem very well and I also know you can´t change people. This means I have given up with this issue. Of course I have in my rules how to deal with private data.I hate spammers and I fight against spam since I opened my forum years ago but it looks like it doesn´t matter how often I tell our user not to post puplic data.
Only a few times I had some user which asked me after months to remove this info from their post.
I don´t use the forums censor but you can try.
View user's profile Send private message Visit poster's website
dad7732
RavenNuke(tm) Development Team


Joined: Mar 18, 2007
Posts: 1191

PostPosted: Tue Mar 09, 2010 2:12 pm Reply with quote Back to top

Just adding the area code numbers of every area code in the USA as censor words would be prohibitive and non-productive anyway. I think it's time to give up as well and deal with the issue when/if it presents itself ... Would be an interesting add-on at any rate. My Son teaches computer science at the college level. May make it a class project .. LOL

Cheers
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Tue Mar 09, 2010 2:27 pm Reply with quote Back to top

dad7732,

I would place the code in a file to be included in modules/forums/posting.php. But you could just paste this code right into the script. Note that I haven't melded the variable names for use in posting.php but have written a more generic form. If you need help in making it fit exactly then just let me know. Also, it shouldn't matted how many times the number is repeated even though I only used 1 for this example.

Catching them all will/may probably take several tries but here is one I put together for you to get you started Smile. Even though it took a couple of hours it was fun! - Enjoy!

Code:
<?php
/***
Find phone numbers in documents using word boundary tokens (\b) in an attempt to avoid non phone number type matches
Written by Gaylen Fraley (aka Raven)
March 9, 2010
Free for use
***/

$op = 'replace';  // match or replace
$testPhoneNumber = '(01)1234567890';
$replacement = '#';
$text = 'This is testing for matching/replacing a phone number type entry of ' . $testPhoneNumber . '. <br />Did it work?';
$origText = $text;  // Don't change this!

$phonePattern     = '\(?\b([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})\b';
$phoneIntlPattern = '\(?\b([0-9]{2})\)?[-. ]?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})\b';  // For including International codes

switch ($op) {
   case 'match':
      if (preg_match_all("/$phoneIntlPattern/", $text, $matches)) {
      // Successful match
         echo '<strong>Match!</strong><br />';
         print_r($matches);
      } else {
      // unSuccessful match
         echo '<strong>No Match.</strong>';
      }
   break;
   case 'replace':
      if (preg_match_all("/$phoneIntlPattern/", $text, $matches)) {
      // Successful match
         echo '<strong>Match!</strong><br />';
         print_r($matches);
         echo '<br /><br /><strong<u>Now I\'ll try and replace/delete the phone number using the $replacement value of ' . $replacement . '.</u></strong><br />';
         echo '<br /><strong><u>Original Text:</u></strong><br />' . $origText . '<br />';
         echo '<br /><strong><u>Modified Text:</u></strong><br />' . preg_replace("/$phoneIntlPattern/", $replacement, $text);
      } else {
      // unSuccessful match
         echo '<strong>No Match.</strong>';
      }
   break;
   default:
   break;
}
?>
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
dad7732
RavenNuke(tm) Development Team


Joined: Mar 18, 2007
Posts: 1191

PostPosted: Tue Mar 09, 2010 2:51 pm Reply with quote Back to top

Added to posting.php as:

include_once("modules/Forums/includes/phone_numbers.php");

And of course created the file "phone_numbers.php" and uploaded to /Forums/includes

When clicking "new post" or "reply" I get at the top:

Quote:
Match!
Array ( [0] => Array ( [0] => (01)1234567890 ) [1] => Array ( [0] => 01 ) [2] => Array ( [0] => 123 ) [3] => Array ( [0] => 456 ) [4] => Array ( [0] => 7890 ) )

Now I'll try and replace/delete the phone number using the $replacement value of #.

Original Text:
This is testing for matching/replacing a phone number type entry of (01)1234567890.
Did it work?

Modified Text:
This is testing for matching/replacing a phone number type entry of #.
Did it work?


And a phone number is still a phone number

Cheers
View user's profile Send private message
wHiTeHaT
Involved
Involved


Joined: Jul 18, 2004
Posts: 442
Location: Netherlands

PostPosted: Tue Mar 09, 2010 3:18 pm Reply with quote Back to top

in viewtopic.php
around line 1163 find :
Code:
        //
        // Replace newlines (we use this rather than nl2br because
        // till recently it wasn't XHTML compliant)
        //
        if ( $user_sig != '' )
        {
                $user_sig = '<br />_________________<br />' . str_replace("\n", "\n<br />\n", $user_sig);
        }


BELOW ADD:

Code:
//TEST
    // VIEW POSTS Find phone contacts

      preg_match_all("/\d\d\d-\d\d-?\d\d/", $message, $phones);
      foreach ($phones[0] as $phone) {
         $message = str_replace($phone, '*-IDIOT you should not give your phonenumber-*', $message);
      }

//END TEST

So it looks something like this:

Code:
        //
        // Replace newlines (we use this rather than nl2br because
        // till recently it wasn't XHTML compliant)
        //
        if ( $user_sig != '' )
        {
                $user_sig = '<br />_________________<br />' . str_replace("\n", "\n<br />\n", $user_sig);
        }
//TEST
    // VIEW POSTS Find phone contacts

      preg_match_all("/\d\d\d-\d\d-?\d\d/", $message, $phones);
      foreach ($phones[0] as $phone) {
         $message = str_replace($phone, '*-IDIOT you should not give your phonenumber-*', $message);
      }

//END TEST
        $message = str_replace("\n", "\n<br />\n", $message);


i tested it with the folowing phonenumber:

123-45-67 you will see it works.
You should ask here abouth what other phone number formats you can expect couse i'm not familiar with other country's phonenumbers.

To create a WARNING in the preview mode (before someone submits a post) you could add in posting.php around line 731 directly below:

Code:
      if( $attach_sig && $user_sig != '' )
      {
         $preview_message = $preview_message . '<br /><br />_________________<br />' . $user_sig;
      }


Code:
// PREVIEW Find phone contacts
   function check_for_phone_in_preview($preview_message) {
      preg_match_all("/\d\d\d-\d\d-?\d\d/", $preview_message, $phones);
      foreach ($phones[0] as $phone) {
         $preview_message = str_replace($phone, '*-IDIOT you should not give your phonenumber-*', $preview_message);
      }
      return $preview_message;
   }
     $preview_message = check_for_phone_in_preview($preview_message);


Have fun!!!

Grtzz wHiTeHaT Wink
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
dad7732
RavenNuke(tm) Development Team


Joined: Mar 18, 2007
Posts: 1191

PostPosted: Tue Mar 09, 2010 3:33 pm Reply with quote Back to top

Both work just fine, even with the customary USA area code format of:

xxx-xxx-xxxx

Such as 504-555-1212 .. area code 504 information

Shows up as 504-*- IDIOT ..... Smile

Works even if submitted and not previewed.

Cheers
View user's profile Send private message
wHiTeHaT
Involved
Involved


Joined: Jul 18, 2004
Posts: 442
Location: Netherlands

PostPosted: Tue Mar 09, 2010 3:34 pm Reply with quote Back to top

a reference especialy for phone numbers can find here:
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
wHiTeHaT
Involved
Involved


Joined: Jul 18, 2004
Posts: 442
Location: Netherlands

PostPosted: Tue Mar 09, 2010 3:37 pm Reply with quote Back to top

it is verry delicate to use such tricks , a problem can occur when someone wants to create a link with a number in it or a model number or part number of an object.
The hard solution would be to exclude all other posseble uses of numbers in a forum post.
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
dad7732
RavenNuke(tm) Development Team


Joined: Mar 18, 2007
Posts: 1191

PostPosted: Tue Mar 09, 2010 4:04 pm Reply with quote Back to top

I understand but in my case there is no problem with links and such with numbers posted for version numbers, etc. Mine is strictly a browser-mail support forum.

Cheers
View user's profile Send private message
dad7732
RavenNuke(tm) Development Team


Joined: Mar 18, 2007
Posts: 1191

PostPosted: Tue Mar 09, 2010 4:11 pm Reply with quote Back to top

All very interesting .. THANKS!!
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Tue Mar 09, 2010 5:07 pm Reply with quote Back to top

dad7732,

As I said Smile I wrote a generic script. That way anyone who uses it can see the progression. To integrate it you will need to leave out the echos and modify the code accordingly for your purposes, which I assumed you could do Wink

In posting.php, around line 1008 depending on your version, you should see the following 4 lines:
Code:
//
// Output the data to the template
//
$template->assign_vars(array(


Before the first line // place your include statement. So now that code looks like this:
Code:
include_once("modules/Forums/includes/phone_numbers.php");
//
// Output the data to the template
//
$template->assign_vars(array(


Now modify the generic script (modules/Forums/includes/phone_numbers.php) to look like this:
Code:
<?php
/***
Find phone numbers in documents using word boundary tokens (\b) in an attempt to avoid non phone number type matches
Written by Gaylen Fraley (aka Raven)
March 9, 2010
Free for use
***/
$testPhoneNumber = '(01)1234567890';
$replacement = '#';
$text = 'This is testing for matching/replacing a phone number type entry of ' . $testPhoneNumber . '. <br />Did it work?';

$phonePattern     = '\(?\b([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})\b';
$phoneIntlPattern = '\(?\b([0-9]{2})\)?[-. ]?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})\b';  // For including International codes
$message = preg_replace("/$phoneIntlPattern/", $replacement, $message);
?>


I do not recommend Whitehat's solution, as it stands, because he is not taking into consideration word boundaries. So a number that is a part of a word/phrase will be caught by his code if it resembles his pattern but isn't really a phone number, ie a false postive. That's why I specifically noted in the credits Find phone numbers in documents using word boundary tokens (\b) in an attempt to avoid non phone number type matches as it will eliminate more false positives. Smile
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
webservant
Worker
Worker


Joined: Feb 26, 2006
Posts: 206
Location: Springfield, MA

PostPosted: Tue Mar 09, 2010 5:19 pm Reply with quote Back to top

Wave Excellent colaboration!!!
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum