Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.4 RN Issues
Author Message
dad7732
RavenNuke(tm) Development Team



Joined: Mar 18, 2007
Posts: 1242

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

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: 2024
Location: North Carolina

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

You could add 0-9 in the censor list in the config file, but no numbers will appear.

_________________
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Send e-mail Visit poster's website
dad7732







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

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

Cheers
 
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

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

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
dad7732







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

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
 
wHiTeHaT
Life Cycles Becoming CPU Cycles



Joined: Jul 18, 2004
Posts: 579

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

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
dad7732







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

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
 
wHiTeHaT







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

here: http://bbantispam.com/lr/ 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.
 
dad7732







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

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

Cheers
 
wHiTeHaT







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

wHiTeHaT wrote:
here: http://bbantispam.com/lr/ 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.
 
dad7732







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

I looked at it and it appears to work only for unregistered "guests". I'll continue to have a look ..
 
wHiTeHaT







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

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.
 
dad7732







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

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

Cheers
 
Susann
Moderator



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

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

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
dad7732







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

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
 
Raven







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

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;
}
?>
 
dad7732







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

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
 
wHiTeHaT







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

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
 
dad7732







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

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
 
wHiTeHaT







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

a reference especialy for phone numbers can find here:
http://www.php.net/manual/en/function.preg-match.php#90503
 
wHiTeHaT







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

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.
 
dad7732







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

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
 
dad7732







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

All very interesting .. THANKS!!
 
Raven







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

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
 
webservant
Worker
Worker



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

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

Wave Excellent colaboration!!!

_________________
Awaiting His Shout
Webservant - GraciousCall.org
Romans 8:28-39 
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.4 RN Issues

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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©