Checking “$Password”


"; // Check for at least one number if (preg_match("/\d/", $Password)== FALSE) { ++$failures; echo "

Warning: “$Password” has no numbers.

"; } // Check for at least one lowercase letter if (preg_match("/[a-z]/", $Password)==FALSE) { ++$failures; echo "

Warning: “$Password” has no lowercase letters.

"; } // Check for at least one uppercase letter if (preg_match("/[A-Z]/", $Password)==FALSE) { ++$failures; echo "

Warning: “$Password” has no uppercase letters

"; } // Check for no spaces if (preg_match("/\s/",$Password)) { ++$failures; echo "

Warning: “$Password” contains one or more spaces

"; } // Check for at least one non-alphanumeric if (preg_match("/\W/", $Password)==FALSE) { ++$failures; echo "

Warning: “$Password” has no non-alphanumeric characters

"; } // Verify the length > 8 and < 16 if (preg_match("/^[\w\W\d]{8,16}$/", $Password)==FALSE) { ++$failures; echo "

Warning: “$Password” must be between 8 and 16 characters

"; } if ($failures == 0) echo "

“$Password” is a strong password

"; else echo "

“$Password” is not a strong password

"; } ?>