function validateForm(&$errors) { global $username, $password1, $password2; if (!validateRequiredForm($username)) { $errors['username'][] = 'User Name is required.'; } else { if (!validateLongerOrEqualString($username, 4)) { $errors['username'][] = 'User Name must be at least 4 characters.'; } } if (!validateRequiredForm($password1)) { $errors['password1'][] = 'Password is required.'; } else { if (!validateLongerOrEqualString($password1, 4)) { $errors['password1'][] = 'Password must be at least 4 characters.'; } if (!validateNonAlphanumeric($password1)) { $errors['password1'][] = 'Password must contain one non-alphanumeric character.'; } } if (!validateRequiredForm($password2)) { $errors['password2'][] = 'Please enter your password again.'; } else { if (!validateLongerOrEqualString($password2, 4)) { $errors['password2'][] = 'Password must be at least 4 characters.'; } if (!validateNonAlphanumeric($password2)) { $errors['password2'][] = 'Password must contain one non-alphanumeric character.'; } if (!validateEqualPasswords($password1, $password2)) { $errors['password2'][] = 'The second password does not match the first one!'; } } return empty($errors); }
function validateForm(&$errors) { global $username, $password, $reppassword; if (!validateRequired($username)) { $errors['username'][] = 'User Name is required.'; } else { if (!validateLongerOrEqualString($username, 4)) { $errors['username'][] = 'Last Name must be at least 4 characters.'; } } if (!validateRequired($password)) { $errors['password'][] = 'Password is required.'; } else { if (!validateLongerOrEqualString($password, 4)) { $errors['password'][] = 'Password must be at least 4 characters.'; } if (!validateNonAlphanumeric($password)) { $errors['password'][] = 'Password must contain one non-alphanumeric character.'; } } if (!validateRequired($reppassword)) { $errors['reppassword'][] = 'Repeat Password is required.'; } else { if (!validateLongerOrEqualString($password, 4)) { $errors['reppassword'][] = 'Password must be at least 4 characters.'; } if (!validateNonAlphanumeric($password)) { $errors['reppassword'][] = 'Password must contain one non-alphanumeric character.'; } if (validateRequired($reppassword)) { if (!validateMatchingPasswords($password, $reppassword)) { $errors['reppassword'][] = "Password do not match!"; } else { $password = md5($password); } } else { $errors['reppassword'][] = 'Password needs to be filled!'; } } }