$data['errEmail'] = 'Email field required!';
}elseif($this->model->findUserByEmail($data['email'])){
$data['errEmail'] = 'This email is already taken';
}
if(empty($data['username'])){
$data['errUserName'] = 'Username field required!';
}
if(empty($data['password'])){
$data['errPassword'] = 'Password field required!';
}elseif($data['password']!==$data['confirmPassword']){
$data['errConfPass'] = 'Passwords are not match';
}
if(empty($data['confirmPassword'])){
$data['errConfPass'] = 'Password Confirm is not completed';
}
is there any way to refactor this code?
Use a validation library, do you use pure php or some framework?
Laravel has a good validator. Why don't you use it?
Обсуждают сегодня