Block PHP contact media

Asked

Viewed 185 times

0

I am developing a system where I need not allow contact forms like email, skype, facebook and phone. I wanted to use str_replace() only that I would have to make a giant list with a few words that it contains in those items and replace with nothing '' . Would you have a plugin or an open-source that already does this service? Or even a basic code?

  • Maybe you do, but to block Skype user I believe not. Maybe you should have a moderator to monitor this.

  • 3

    Set "Do not allow contact forms".

  • @Renan, what he means is not allow contact data, described there in the question email, skype, facebook e telefone

  • 1

    Don’t allow how? User can’t write in a text box? Can’t have in profile? Can’t mention in comment?

1 answer

2


Users will find a way to pass on personal information.

If you can’t email: [email protected], someone will change until your rule fails: papa arroba charlie ponto com, papa(a)charlie dot com... infinite possibilities.


I recommend an algorithm that looks for certain words, but does not stop the registration, just create an alert that there is a possible contact information for you to analyze.

  1. An ER can find email or phone numbers, Skype or FB profile, Twitter, or any other social networking site.

  2. You can create an array of (0, 1, 2, ... 9) and an array of (zero, um, dois, ... nove) and scroll through the text to find possible combinations between numbers and text.

I made a simple example, you can see in ideone.


function validate( $string )
{
    // caracteres que serão encontrados em sequencia
    $block[]   = array(1,2,3,4,5,6,7,8,9,0);
    $block[]   = array('um','dois','tres','quatro','cinco','seis','sete','oito','nove','zero');
    $block     = array_merge( $block[0] , $block[1] );

    // agrupa a sequencia encontrada
    $sequencia = array();
    $string    = explode( ' ' , $string );

    // procura a sequencia de 3 caracteres quee stiverem no `array block`
    // palavra anterior + palavra atual + palavra seguinte formando uma sequencia de 3 caracteres
    foreach( $string as $i => $palavra )
    {
        $match = array();

        if( isset( $string[$i-1] ) )
        $match[] = $string[$i-1];

        $match[] = $string[$i];

        if( isset( $string[$i+1] ) )
        $match[] = $string[$i+1];


        $possivel = array_intersect( $match , $block );
        if( count( $possivel ) === 3 )
        $sequencia[] = $possivel;
    }

    return $sequencia;
}

in this example below the output will be a multidimensional array with array('1' , 'dois' , '3' ) and array('quatro' , 'cinco' , 'zero' )

$sequencia = validate( "meu 1 dois 3 telefone ligue quatro cinco zero" );

if( count( $sequencia ) > 0 )
{
    echo printr( 'possível sequência: ' );
    echo printr( $sequencia );
}
else
{
    echo printr( 'parece ok.' );
}

Note that the sequence will take into account the spelling. You can increment an ER together so that the spelling is not impediment. It is simple and server as base.

  • Although your example is not 100% what I need, but it served me as a basis, as you said yourself, the user will try to circumvent in all ways the way to put email or some contact information. I think the most appropriate is to put a moderator to view the messages, same as Workana.

  • @Alissonacioli Yes, they will try between special characters, between letters, in English... There are many possibilities - the rule would be immense. So when there is suspicion, create an alert, or moderation as you quoted.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.