here we go with a need for difficult passwords

This commit is contained in:
Thies Mueller 2021-01-08 19:04:32 +01:00
parent 9c641b8b89
commit 2b0dd631f3

View File

@ -14,7 +14,13 @@ $pdo = new PDO('mysql:host=localhost;dbname=usertable', 'usertable', 'password')
<?php
$showFormular = true;
//regexes for validation:
$REuppercase = preg_match('@[A-Z]@', $password);
$RElowercase = preg_match('@[a-z]@', $password);
$REnumber = preg_match('@[0-9]@', $password);
$REspecialChars = preg_match('@[^\w]@', $password);
if(isset($_GET['register'])) {
$error = false;
$email = $_POST['email'];
@ -36,6 +42,11 @@ if(isset($_GET['register'])) {
echo 'passwords doesnt match<br>';
$error = true;
}
if(!$REuppercase || !$RElowercase || !$REnumber || !$REspecialChars || strlen($password) < 8) {
echo 'Password needs to be more complex.<br />';
echo 'Please implement at least 8 chars, upper & downer caser, one number & one special char.<br />';
$error = true;
}
if(!$error) {