How to "verify" the names of people in CakePHP?

I have a PHP script that should check for "valid" human names, but recently cracked into a name with a space, so we added spaces to our validator.
Instead of doing this, is there a way to add a blacklist to CakePHP's checker to block all “invalid” characters, instead of allowing “valid” ones?

NOTE. I know how to do this in PHP (usually), but using CakePHP syntax syntax is different.

+2
source share
4 answers

I agree with other comments that checking the name is probably a bad idea.

For almost everything you can come up with for verification, there will be someone with a name that violates your rule. If you are happy with the idea that you are going to block real people from entering their names, then you can check it as much as you want. But the more verification rules you enter, the more likely you are to find a real person who cannot enter.

Here is a link to a page that describes some of the obvious (and not so obvious) things that people are trying to verify that they can turn them off:

http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/

, , , . - .

+15

"". - :

'); DROP TABLE ; -

http://xkcd.com/327/


EDIT: , (, , , ) . , , "INVALID", ?

+8

, . (, ) , XSS.

afterFind(), -. , ['unescaped_name'], .

+4

var $validate = array(
    'name' => array(
        'rule' => '/^[^%#\/*@!...other characters you don\'t want...]+$/',  
        'message' => 'Only letters and integers, min 3 characters'
    )
);

, . , , . , , . , 100% . ( ), *.

* , 100% , 99,9% .

+4

All Articles