06.15
php
saved
jesirose
Note
The problem is with my regex. When I enter the following usernames, I get the correct error that they can only contain letters, numbers and _
testing$
te$ting$
The following usernames SHOULD produce the error but DO NOT. What is wrong?
te$ting
$te$ting
($ can be any character that is not num or letter, #, &, etc.)
It appears the problem is when the string ends with a character it shouldn't. What is wrong?
The problem is with my regex. When I enter the following usernames, I get the correct error that they can only contain letters, numbers and _
testing$
te$ting$
The following usernames SHOULD produce the error but DO NOT. What is wrong?
te$ting
$te$ting
($ can be any character that is not num or letter, #, &, etc.)
It appears the problem is when the string ends with a character it shouldn't. What is wrong?
- <?php
- Class User extends AppModel{
- var $name = 'User';
- var $primaryKey = 'UserID';
- 'inUse'=>array(
- 'rule'=>array('fieldInUse','username', 0),
- 'message'=>'That username is already in use'
- ),
- 'message' => 'Your username may only use letters, numbers and the underscore character',
- ),
- 'message' => 'Your username must be between 4 and 20 characters long'
- )
- )
- //Check if a unique field already has that value
- function fieldInUse($data, $field, $limit){
- return $count <= $limit;
- }
- );
Parsed in 0.068 seconds, using GeSHi 1.0.7.14