0

I have a personal registration area. I already have a condition to check that the password and the password confirmation are identical. I wanted to add a condition to check that the password does not contain less than 8 characters. here is the beginning of my code:

$error = false;
if (!empty($_POST)) {
    $d = $_POST;
    if ($d['user_pass'] != $d['user_pass2']) {
        $error = 'not same password !';
    } else {
        if ($d['user_pass'] && $d['user_pass2'] < 8) {
            $error = '8 caracaters min';
        } else {
            if (!is_email($d['user_email'])) {
                $error = 'mail invalid';

I must not be far away any password returns me the error "8 caracters min".

1 Answer 1

2

You need to use strlen() to determine the length of a variable, so your second if condition is invalid.

As it is, this question is not really related to Wordpress, so likely off-topic.

Not the answer you're looking for? Browse other questions tagged or ask your own question.