K
K
Kirill Sidorov2011-10-25 07:17:38
PHP
Kirill Sidorov, 2011-10-25 07:17:38

Ban phone numbers in the web application

There is a bulletin board, and some comrades have already honestly got it. Decided to ban.
I created a new table in the database, I decided to store regexps there and then check it.

public  function  addUserAd ( )  {
    ...
    $bannedPhonesPatterns  =  $this -> getBannedPhones ( ) ;
    foreach (  $bannedPhonesPatterns  as  $patt  )  {
        if  (  preg_match ( $patt ,  $body . $contacts )  )  {
            $this -> reportError ( 12 ) ;
            $this -> terminate ( ) ;
        }
    }
    ...
}


Now there are 4 numbers in the database, but the list will be replenished, I'm worried about performance. How else can such a system be organized?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan Leviev, 2011-10-25
@ruskar

IMHO, the usual ways to ban by phone are useless. I'm just very familiar with the work of the boards "from the inside" and with the methods of work of these very "some comrades".
Here's what these comrades will do when they see the message "Ad is not posted, because. your phone number has been banned from our website!” ? Yes, they stupidly take another number and post their ad. And so on until next time.
On one of my projects, I solved the problem in a different way. The task is this: to identify the “bad person” as reliably as possible.

What am I doing for this?


If a user has provided a phone number for their ad that is on my blacklist, I:
  1. I set him perpetual Cookies with the label that this user is still parsley;
  2. I also remember in the database the maximum amount of data identifying it (IP, browser user agent, etc.);
  3. I save his ad in the database and mark it as "half-hidden". This means that the ad is visible only to him, for him the appearance is created that everything went well and the ad was published. In fact, it is not shown to all other users of the site (including those who are not logged in);
  4. if the “bad person” guessed that I deceived him and now he drives in his next slag, then using points 1 and 2 I determine it again, blacklist the new number, repeat points 1 and 2.

As a result, all the “radishes” look at my site satisfied, they think that I published their ads normally, they don’t try to bypass the protection in all possible and impossible ways (because they thought they bypassed it), but in reality the site remains clean.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question