Question: Part 1 Create php document named password.php. Create an array of 10 possible passwords, 5 good and 5 bad based on the following criteria: 1.
Part 1
Create php document named password.php. Create an array of 10 possible passwords, 5 good and 5 bad based on the following criteria:
1. A good password should contain at least 12 characters.
2. A good password should contain at least one number, one lowercase letter, one uppercase letter, and one non alphanumeric character.
3. A password cannot have a space in it.
Part 2 Create a function named checkPassword that does the following:
1. Receives as a parameter a password.
2. Uses functions and Regular Expressions to check the rules for a password.
3. If the password is invalid, return a string that contains the password and a description of why it is invalid.
4. Returns TRUE Boolean value if the password is valid.
Part 3 Create main logic for password.php page to do the following:
1. Use a foreach loop to check each password to see if it is good or bad.
2. Call the checkPassword function in the loop to see if the password is valid.
3. In the loop depending on the results display the message that is returned from the checkPassword function and if it is a good password display a message to indicate it is good.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
