Data Validation During Registration in PHP
Currently, we are not imposing any restrictions on the login-password pair; however, this is incorrect. For example, users could accidentally or intentionally register with an empty login or password, or with a password consisting of a single character. Such a password would be too simple and insecure.
Please note that if any field is filled in incorrectly, the form should not be cleared, as this would inconvenience the user: they entered and entered data, clicked - and everything is gone, even though the mistake might have been in just one character.
Modify your code so that it is impossible to register a user with an empty login or password.
Modify your code so that the login can only contain Latin letters and numbers. If this is not the case, display a message about it above the form.
Modify your code so that the login is
from 4 to 10 characters long.
If this is not the case, display a message
about it above the form.
Modify your code so that the password is
from 6 to 12 characters long.
If this is not the case, display a message
about it above the form.
Modify your code so that if the login or password is entered incorrectly, a message about it is displayed above the corresponding input field.
Ask the user during registration for an email as well. Enter it into the database. Perform email validation and, if it is incorrect, display a message about it above the corresponding input field.
Ask the user during registration for their date of birth in the format day.month.year. Enter the date into the database. Perform validation of the date to ensure it matches the format.
Ask the user during registration for their
country of residence. Offer them to choose
one of the countries using a dropdown list
select.