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!'; } } }
function validateForm($username, $password1, $password2) { global $errors; global $password; if (validateRequired($username)) { if (!validateString($username)) { $errors['username'][] = 'Username needs to be String!'; } if (!validateAlphabethUsed($username)) { $errors['username'][] = 'Username needs to be in latin characters!'; } if (!validateLength($username, 5)) { $errors['username'][] = 'Username needs to be at least 5 characters long!'; } } else { $errors['username'][] = 'Username needs to be filled!'; } if (validateRequired($password1)) { if (!validateLength($password1, 5)) { $errors['password1'][] = 'Password needs to be at least 5 characters long!'; } if (!validatePassword($password1)) { $errors['password1'][] = "Password need to consist of one of the three of Capital, \nSmall letters, Digits and Special characters"; } } else { $errors['password1'][] = 'Password needs to be filled!'; } if (validateRequired($password2)) { if (!validateLength($password2, 5)) { $errors['password2'][] = 'Password needs to be at least 5 characters long!'; } if (!validatePassword($password2)) { $errors['password2'][] = "Password need to consist of one of the three of Capital, \nSmall letters, Digits and Special characters"; } if (validateRequired($password1)) { if (!validateMatchingPasswords($password1, $password2)) { $errors['password2'][] = "Password do not match!"; } else { $password = md5($password1); } } } else { $errors['password2'][] = 'Password needs to be filled!'; } }