2
0

add things from 27-03-26

This commit is contained in:
2026-04-28 13:27:52 +02:00
parent 39c8234b6d
commit 24d89ac51c
3 changed files with 24 additions and 37 deletions

View File

@@ -1,22 +1,5 @@
<?php
/**
* Check password strength (1/2)
* @param string $password password to check
* @return bool - true or false
*/
function isStrongPassword(string $password): bool
{
// min. 8 Zeichen, 1 Kleinbuchstabe, 1 Großbuchstabe, 1 Zahl, 1 Sonderzeichen
return (bool) preg_match(
'/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^a-zA-Z0-9]).{8,}$/',
$password
);
}
/**
* Check password strength (2/2)
* @param string $password password to check
@@ -41,7 +24,10 @@ function checkPasswordStrength(string $password): bool {
//check if spec. chars
if(preg_match('/[^a-zA-Z0-9]/', $password)) $strength++;
// valid password: #Test12345
return($strength >= 5);
}
function isValidEmail(string $email):bool {
return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
}